summaryrefslogtreecommitdiff
path: root/src/AbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-10 01:17:28 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2011-08-10 01:17:28 +0900
commite8e3a6f259ab74c486aec9b5ea95d3e1f5068f6c (patch)
tree81530df222473d79cf39e007729b0d882441ebfb /src/AbstractCommand.cc
parent97f34ab6682d83d9a0265a4291b44eaf45703493 (diff)
wallclock is now retrieved using global::wallclock() call.
This is necessary to avoid global variable initialization order problem.
Diffstat (limited to 'src/AbstractCommand.cc')
-rw-r--r--src/AbstractCommand.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index 16f5f004..0b181060 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -85,7 +85,7 @@ AbstractCommand::AbstractCommand
const SocketHandle& s,
const SharedHandle<SocketRecvBuffer>& socketRecvBuffer,
bool incNumConnection)
- : Command(cuid), checkPoint_(global::wallclock),
+ : Command(cuid), checkPoint_(global::wallclock()),
timeout_(requestGroup->getTimeout()),
requestGroup_(requestGroup),
req_(req), fileEntry_(fileEntry), e_(e), socket_(s),
@@ -93,7 +93,7 @@ AbstractCommand::AbstractCommand
checkSocketIsReadable_(false), checkSocketIsWritable_(false),
nameResolverCheck_(false),
incNumConnection_(incNumConnection),
- serverStatTimer_(global::wallclock)
+ serverStatTimer_(global::wallclock())
{
if(socket_ && socket_->isOpen()) {
setReadCheckSocket(socket_);
@@ -184,8 +184,8 @@ bool AbstractCommand::execute() {
if(req_ && fileEntry_->getLength() > 0 &&
e_->getRequestGroupMan()->getMaxOverallDownloadSpeedLimit() == 0 &&
requestGroup_->getMaxDownloadSpeedLimit() == 0 &&
- serverStatTimer_.difference(global::wallclock) >= 10) {
- serverStatTimer_ = global::wallclock;
+ serverStatTimer_.difference(global::wallclock()) >= 10) {
+ serverStatTimer_ = global::wallclock();
std::vector<std::pair<size_t, std::string> > usedHosts;
if(getOption()->getAsBool(PREF_SELECT_LEAST_USED_HOST)) {
getDownloadEngine()->getRequestGroupMan()->getUsedHosts(usedHosts);
@@ -209,7 +209,7 @@ bool AbstractCommand::execute() {
#endif // ENABLE_ASYNC_DNS
(!checkSocketIsReadable_ && !checkSocketIsWritable_ &&
!nameResolverCheck_)) {
- checkPoint_ = global::wallclock;
+ checkPoint_ = global::wallclock();
if(getPieceStorage()) {
if(!req_ || req_->getMaxPipelinedRequest() == 1 ||
// Why the following condition is necessary? That's because
@@ -263,7 +263,7 @@ bool AbstractCommand::execute() {
throw DL_RETRY_EX(fmt(MSG_NETWORK_PROBLEM,
socket_->getSocketError().c_str()));
} else {
- if(checkPoint_.difference(global::wallclock) >= timeout_) {
+ if(checkPoint_.difference(global::wallclock()) >= timeout_) {
// timeout triggers ServerStat error state.
SharedHandle<ServerStat> ss =
e_->getRequestGroupMan()->getOrCreateServerStat(req_->getHost(),
@@ -339,7 +339,7 @@ bool AbstractCommand::execute() {
tryReserved();
return true;
} else {
- Timer wakeTime(global::wallclock);
+ Timer wakeTime(global::wallclock());
wakeTime.advance(getOption()->getAsInt(PREF_RETRY_WAIT));
req_->setWakeTime(wakeTime);
return prepareForRetry(0);