//-----------------------------------------------------------------------------
void * LISTENER::Run(void * d)
{
-LISTENER * ia = static_cast<LISTENER *>(d);
+LISTENER * listener = static_cast<LISTENER *>(d);
-ia->Runner();
+listener->Runner();
return NULL;
}
//-----------------------------------------------------------------------------
void * LISTENER::RunProcessor(void * d)
{
-LISTENER * ia = static_cast<LISTENER *>(d);
+LISTENER * listener = static_cast<LISTENER *>(d);
-ia->ProcessorRunner();
+listener->ProcessorRunner();
return NULL;
}
return true;
}
-printfd(__FILE__, "Port: %d\n", port);
-
struct sockaddr_in listenAddr;
listenAddr.sin_family = AF_INET;
listenAddr.sin_port = htons(port);
iov[0].iov_base = reinterpret_cast<char *>(&packetHead);
iov[0].iov_len = sizeof(packetHead);
iov[1].iov_base = buffer;
-iov[1].iov_len = sizeof(buffer);
+iov[1].iov_len = sizeof(buffer) - sizeof(packetHead);
size_t dataLen = 0;
while (dataLen < sizeof(buffer))
}
std::stringstream params;
-params << data.login << " "
+params << "\"" << data.login << "\" "
<< inet_ntostring(data.ip) << " "
<< data.id << " "
<< (char *)packetTail.params;
//-----------------------------------------------------------------------------
void LISTENER::ProcessPending()
{
-printfd(__FILE__, "Pending data size: %d\n", pending.size());
std::list<PendingData>::iterator it(pending.begin());
-while (it != pending.end())
+size_t count = 0;
+printfd(__FILE__, "Pending: %d\n", pending.size());
+while (it != pending.end() && count < 256)
{
std::vector<AliveData>::iterator uit(
std::lower_bound(
users.erase(uit);
}
}
-
- STG_LOCKER lock(&mutex, __FILE__, __LINE__);
- pending.erase(it++);
+ ++it;
+ ++count;
}
+STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+pending.erase(pending.begin(), it);
}
//-----------------------------------------------------------------------------
void LISTENER::ProcessTimeouts()