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
pull/1/head
Tatsuhiro Tsujikawa 2010-01-10 07:51:45 +00:00
parent 643d28fb3c
commit 558541ec48
4 changed files with 22 additions and 4 deletions

View File

@ -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.

View File

@ -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;
}
};

View File

@ -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

View File

@ -483,6 +483,8 @@ public:
}
static void resetGIDCounter() { _gidCounter = 0; }
static int32_t newGID();
};
typedef SharedHandle<RequestGroup> RequestGroupHandle;