mirror of https://github.com/aria2/aria2
2010-01-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Reset GID to 1 when they reach maximum value. Rewritten CUIDCounter::newID() * src/CUIDCounter.h * src/RequestGroup.cc * src/RequestGroup.hpull/1/head
parent
643d28fb3c
commit
558541ec48
|
@ -1,3 +1,11 @@
|
|||
2010-01-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Reset GID to 1 when they reach maximum value. Rewritten
|
||||
CUIDCounter::newID()
|
||||
* src/CUIDCounter.h
|
||||
* src/RequestGroup.cc
|
||||
* src/RequestGroup.h
|
||||
|
||||
2010-01-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Documented --http-no-cache option in man page.
|
||||
|
|
|
@ -50,11 +50,10 @@ public:
|
|||
|
||||
cuid_t newID()
|
||||
{
|
||||
cuid_t id = ++_count;
|
||||
if(id == INT32_MAX) {
|
||||
if(_count == INT32_MAX) {
|
||||
_count = 0;
|
||||
}
|
||||
return id;
|
||||
return ++_count;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ int32_t RequestGroup::_gidCounter = 0;
|
|||
const std::string RequestGroup::ACCEPT_METALINK = "application/metalink+xml";
|
||||
|
||||
RequestGroup::RequestGroup(const SharedHandle<Option>& option):
|
||||
_gid(++_gidCounter),
|
||||
_gid(newGID()),
|
||||
_option(new Option(*option.get())),
|
||||
_numConcurrentCommand(option->getAsInt(PREF_SPLIT)),
|
||||
_numStreamConnection(0),
|
||||
|
@ -267,6 +267,7 @@ void RequestGroup::createInitialCommand
|
|||
(_option->getAsInt(PREF_BT_TRACKER_INTERVAL));
|
||||
btAnnounce->shuffleAnnounce();
|
||||
|
||||
assert(btRegistry->get(_gid).isNull());
|
||||
btRegistry->put(_gid,
|
||||
BtObject(_downloadContext,
|
||||
_pieceStorage,
|
||||
|
@ -1081,4 +1082,12 @@ void RequestGroup::setDownloadContext
|
|||
}
|
||||
}
|
||||
|
||||
int32_t RequestGroup::newGID()
|
||||
{
|
||||
if(_gidCounter == INT32_MAX) {
|
||||
_gidCounter = 0;
|
||||
}
|
||||
return ++_gidCounter;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -483,6 +483,8 @@ public:
|
|||
}
|
||||
|
||||
static void resetGIDCounter() { _gidCounter = 0; }
|
||||
|
||||
static int32_t newGID();
|
||||
};
|
||||
|
||||
typedef SharedHandle<RequestGroup> RequestGroupHandle;
|
||||
|
|
Loading…
Reference in New Issue