Summary: | Bandwidth Scheduler not adjusting speeds when time restrictions crossed | ||
---|---|---|---|
Product: | [Applications] ktorrent | Reporter: | Colin Pinkney <colin.pinkney> |
Component: | general | Assignee: | Joris Guisson <joris.guisson> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version First Reported In: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Colin Pinkney
2006-07-23 17:48:40 UTC
It seems that the timer triggers 1 second before the hour changes, so if you set your schedule to 4 PM, the timer fires at 3:59 and 59 seconds, so the limits for the previous hour are chosen. It seems the timer needs some tweaking. SVN commit 565904 by guisson: Scheduler timer now fires after the hour so that the correct up and down caps are chosen. BUG: 131246 M +16 -12 bwscheduler.cpp M +2 -1 schedulerplugin.cpp --- trunk/extragear/network/ktorrent/plugins/scheduler/bwscheduler.cpp #565903:565904 @@ -172,39 +172,43 @@ { case CAT_NORMAL: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to NORMAL category" << endl; - + Out(SYS_SCD|LOG_NOTICE) << prefix << QString("%1 Up, %2 Down") + .arg(m_core->getMaxUploadSpeed()).arg(m_core->getMaxDownloadSpeed()) << endl; if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1024 * m_core->getMaxDownloadSpeed()); - net::SocketMonitor::setUploadCap(1024 * m_core->getMaxUploadSpeed()); + net::SocketMonitor::setDownloadCap(1000 * m_core->getMaxDownloadSpeed()); + net::SocketMonitor::setUploadCap(1000 * m_core->getMaxUploadSpeed()); break; case CAT_FIRST: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to FIRST category" << endl; - + Out(SYS_SCD|LOG_NOTICE) << prefix << QString("%1 Up, %2 Down") + .arg(m_schedule.getUpload(0)).arg(m_schedule.getDownload(0)) << endl; if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1024 * m_schedule.getDownload(0)); - net::SocketMonitor::setUploadCap(1024 * m_schedule.getUpload(0)); + net::SocketMonitor::setDownloadCap(1000 * m_schedule.getDownload(0)); + net::SocketMonitor::setUploadCap(1000 * m_schedule.getUpload(0)); break; case CAT_SECOND: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to SECOND category" << endl; - + Out(SYS_SCD|LOG_NOTICE) << prefix << QString("%1 Up, %2 Down") + .arg(m_schedule.getUpload(1)).arg(m_schedule.getDownload(1)) << endl; if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1024 * m_schedule.getDownload(1)); - net::SocketMonitor::setUploadCap(1024 * m_schedule.getUpload(1)); + net::SocketMonitor::setDownloadCap(1000 * m_schedule.getDownload(1)); + net::SocketMonitor::setUploadCap(1000 * m_schedule.getUpload(1)); break; case CAT_THIRD: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to THIRD category" << endl; - + Out(SYS_SCD|LOG_NOTICE) << prefix << QString("%1 Up, %2 Down") + .arg(m_schedule.getUpload(2)).arg(m_schedule.getDownload(2)) << endl; if(!m_core) break; m_core->setPausedState(false); - net::SocketMonitor::setDownloadCap(1024 * m_schedule.getDownload(2)); - net::SocketMonitor::setUploadCap(1024 * m_schedule.getUpload(2)); + net::SocketMonitor::setDownloadCap(1000 * m_schedule.getDownload(2)); + net::SocketMonitor::setUploadCap(1000 * m_schedule.getUpload(2)); break; case CAT_OFF: Out(SYS_SCD|LOG_NOTICE) << prefix << "Switching to OFF" << endl; --- trunk/extragear/network/ktorrent/plugins/scheduler/schedulerplugin.cpp #565903:565904 @@ -86,7 +86,8 @@ QDateTime round(hour.date(), t); - int secs_to = now.secsTo(round); + // add a 5 second safety margin (BUG: 131246) + int secs_to = now.secsTo(round) + 5; m_timer.start(secs_to*1000); |