My question is below:
I read the manaserv's source code and found it in the utils/tokencollector.cpp
Code: Select all
void TokenCollectorBase::insertClient(const std::string &token, intptr_t data)
{
for (std::list<Item>::reverse_iterator it = mPendingConnects.rbegin(),
it_end = mPendingConnects.rend(); it != it_end; ++it)
{
if (it->token == token)
{
foundMatch(data, it->data);
mPendingConnects.erase(--it.base());
return;
}
}
time_t current = time(NULL);
Item item;
item.token = token;
item.data = data;
item.timeStamp = current;
mPendingClients.push_back(item);
removeOutdated(current);
}
In what situations it will be necessary?
Similar logic exists in TokenCollectorBase::insertConnect too.
Code: Select all
void TokenCollectorBase::insertConnect(const std::string &token, intptr_t data)
{
for (std::list<Item>::reverse_iterator it = mPendingClients.rbegin(),
it_end = mPendingClients.rend(); it != it_end; ++it)
{
if (it->token == token)
{
foundMatch(it->data, data);
mPendingClients.erase(--it.base());
return;
}
}
time_t current = time(NULL);
Item item;
item.token = token;
item.data = data;
item.timeStamp = current;
mPendingConnects.push_back(item);
removeOutdated(current);
}
Thank you very much.