mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 18:49:03 -04:00
This may not compile, I'll test it on my desktop. Waiting 20 minutes for a build is unacceptable.
- Move UUID initialisation to InspIRCd::InitialiseUID() - Call it if we run out of existing UUIDs - Call it on startup Just a small cleanup. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8007 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
46a4409b75
commit
b2b7bfd5e9
@ -273,6 +273,10 @@ class CoreExport InspIRCd : public classbase
|
||||
*/
|
||||
void DoSocketTimeouts(time_t TIME);
|
||||
|
||||
/** Sets up UID subsystem
|
||||
*/
|
||||
void InitialiseUID();
|
||||
|
||||
/** Perform background user events such as PING checks
|
||||
* @param TIME the current time
|
||||
*/
|
||||
|
@ -435,7 +435,7 @@ InspIRCd::InspIRCd(int argc, char** argv)
|
||||
this->Modules->handles.resize(255);
|
||||
|
||||
/*
|
||||
* Initialise UID. XXX, we need to read SID from config, and use it instead of 000.
|
||||
* Initialise SID/UID.
|
||||
* For an explanation as to exactly how this works, and why it works this way, see GetUID().
|
||||
* -- w00t
|
||||
*/
|
||||
@ -457,13 +457,8 @@ InspIRCd::InspIRCd(int argc, char** argv)
|
||||
|
||||
Config->sid = sid;
|
||||
}
|
||||
current_uid[0] = sid / 100 + 48;
|
||||
current_uid[1] = ((sid / 10) % 10) + 48;
|
||||
current_uid[2] = sid % 10 + 48;
|
||||
|
||||
/* Initialise UID */
|
||||
for(i = 3; i < UUID_LENGTH - 1; i++)
|
||||
current_uid[i] = 'A';
|
||||
this->InitialiseUID();
|
||||
|
||||
/* set up fake client */
|
||||
this->FakeClient = new userrec(this);
|
||||
@ -577,6 +572,20 @@ InspIRCd::InspIRCd(int argc, char** argv)
|
||||
this->WritePID(Config->PID);
|
||||
}
|
||||
|
||||
/* moved to a function, as UID generation can call this also */
|
||||
void InspIRCd::InitialiseUID()
|
||||
{
|
||||
size_t sid = Config->sid;
|
||||
|
||||
current_uid[0] = sid / 100 + 48;
|
||||
current_uid[1] = ((sid / 10) % 10) + 48;
|
||||
current_uid[2] = sid % 10 + 48;
|
||||
|
||||
/* Initialise UID */
|
||||
for(i = 3; i < UUID_LENGTH - 1; i++)
|
||||
current_uid[i] = 'A';
|
||||
}
|
||||
|
||||
void InspIRCd::DoOneIteration(bool process_module_sockets)
|
||||
{
|
||||
#ifndef WIN32
|
||||
|
@ -173,9 +173,11 @@ std::string InspIRCd::GetUID()
|
||||
|
||||
if (current_uid[3] == 'Z')
|
||||
{
|
||||
/* If we get to here, we need to wrap around to AAAA. */
|
||||
for(int j = 3; j < UUID_LENGTH - 1; j++)
|
||||
current_uid[j] = 'A';
|
||||
/*
|
||||
* Ugh. We have run out of room.. roll back around to the
|
||||
* start of the UUID namespace. -- w00t
|
||||
*/
|
||||
this->InitialiseUID();
|
||||
|
||||
/*
|
||||
* and now we need to break the inner for () to continue the while (),
|
||||
|
Loading…
x
Reference in New Issue
Block a user