2010-03-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Replaced Time::reset() call with assigning of global::wallclock.
	* src/BtLeecherStateChoke.cc
	* src/BtSeederStateChoke.cc
	* src/PeerSessionResource.cc
	* src/RequestSlot.cc
	* src/ServerStat.cc
	* src/SpeedCalc.cc
pull/1/head
Tatsuhiro Tsujikawa 2010-03-06 14:30:05 +00:00
parent b1713e6373
commit e3b5d60893
7 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,13 @@
2010-03-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced Time::reset() call with assigning of global::wallclock.
* src/BtLeecherStateChoke.cc
* src/BtSeederStateChoke.cc
* src/PeerSessionResource.cc
* src/RequestSlot.cc
* src/ServerStat.cc
* src/SpeedCalc.cc
2010-03-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added changeUri XML-RPC method. This method removes/adds URIs

View File

@ -191,7 +191,7 @@ BtLeecherStateChoke::executeChoke
(const std::vector<SharedHandle<Peer> >& peerSet)
{
_logger->info("Leecher state, %d choke round started", _round);
_lastRound.reset();
_lastRound = global::wallclock;
std::vector<PeerEntry> peerEntries;
std::transform(peerSet.begin(), peerSet.end(),

View File

@ -139,7 +139,7 @@ BtSeederStateChoke::executeChoke
(const std::vector<SharedHandle<Peer> >& peerSet)
{
_logger->info("Seeder state, %d choke round started", _round);
_lastRound.reset();
_lastRound = global::wallclock;
std::vector<PeerEntry> peerEntries;

View File

@ -40,6 +40,7 @@
#include "BitfieldMan.h"
#include "A2STR.h"
#include "BtMessageDispatcher.h"
#include "wallclock.h"
namespace aria2 {
@ -68,7 +69,7 @@ void PeerSessionResource::amChoking(bool b)
{
_amChoking = b;
if(!b) {
_lastAmUnchoking.reset();
_lastAmUnchoking = global::wallclock;
}
}
@ -252,7 +253,7 @@ void PeerSessionResource::updateDownloadLength(size_t bytes)
{
_peerStat.updateDownloadLength(bytes);
_lastDownloadUpdate.reset();
_lastDownloadUpdate = global::wallclock;
}
uint64_t PeerSessionResource::getCompletedLength() const

View File

@ -40,7 +40,7 @@ namespace aria2 {
RequestSlot RequestSlot::nullSlot = RequestSlot();
void RequestSlot::setDispatchedTime() {
dispatchedTime.reset();
dispatchedTime = global::wallclock;
}
void RequestSlot::setDispatchedTime(time_t secFromEpoch) {

View File

@ -39,6 +39,7 @@
#include "array_fun.h"
#include "LogFactory.h"
#include "wallclock.h"
namespace aria2 {
@ -77,7 +78,7 @@ void ServerStat::updateDownloadSpeed(unsigned int downloadSpeed)
if(downloadSpeed > 0) {
_status = OK;
}
_lastUpdated.reset();
_lastUpdated = global::wallclock;
}
void ServerStat::setSingleConnectionAvgSpeed
@ -184,7 +185,7 @@ void ServerStat::setStatusInternal(STATUS status)
_hostname.c_str(), _protocol.c_str());
}
_status = status;
_lastUpdated.reset();
_lastUpdated = global::wallclock;
}
void ServerStat::setOK()

View File

@ -51,11 +51,11 @@ SpeedCalc::SpeedCalc():sw(0), maxSpeed(0), prevSpeed(0), accumulatedLength(0),
void SpeedCalc::reset() {
std::fill(&lengthArray[0], &lengthArray[2], 0);
std::for_each(&cpArray[0], &cpArray[2], std::mem_fun_ref(&Time::reset));
std::fill(&cpArray[0], &cpArray[2], global::wallclock);
sw = 0;
maxSpeed = 0;
prevSpeed = 0;
start.reset();
start = global::wallclock;
accumulatedLength = 0;
nextInterval = CHANGE_INTERVAL_SEC;
}
@ -95,7 +95,7 @@ bool SpeedCalc::isIntervalOver(int64_t milliElapsed) const
void SpeedCalc::changeSw() {
lengthArray[sw] = 0;
cpArray[sw].reset();
cpArray[sw] = global::wallclock;
sw ^= 0x01;
nextInterval = cpArray[sw].difference(global::wallclock)+CHANGE_INTERVAL_SEC;
}