printfd(__FILE__, "LISTENER::Stop()\n");
-usleep(500000);
+struct timespec ts = {0, 500000000};
+nanosleep(&ts, NULL);
if (!processorStopped)
{
//5 seconds to thread stops itself
for (int i = 0; i < 25 && !processorStopped; i++)
{
- usleep(200000);
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
//after 5 seconds waiting thread still running. now killing it
//5 seconds to thread stops itself
for (int i = 0; i < 25 && !receiverStopped; i++)
{
- usleep(200000);
+ struct timespec ts = {0, 200000000};
+ nanosleep(&ts, NULL);
}
//after 5 seconds waiting thread still running. now killing it
//-----------------------------------------------------------------------------
void * LISTENER::Run(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
LISTENER * listener = static_cast<LISTENER *>(d);
listener->Runner();
//-----------------------------------------------------------------------------
void * LISTENER::RunProcessor(void * d)
{
+sigset_t signalSet;
+sigfillset(&signalSet);
+pthread_sigmask(SIG_BLOCK, &signalSet, NULL);
+
LISTENER * listener = static_cast<LISTENER *>(d);
listener->ProcessorRunner();
while (running)
{
- usleep(500000);
+ struct timespec ts = {0, 500000000};
+ nanosleep(&ts, NULL);
if (!pending.empty())
ProcessPending();
ProcessTimeouts();
struct iovec iov[2];
char buffer[RS_MAX_PACKET_LEN];
-RS_PACKET_HEADER packetHead;
+RS::PACKET_HEADER packetHead;
iov[0].iov_base = reinterpret_cast<char *>(&packetHead);
iov[0].iov_len = sizeof(packetHead);
//-----------------------------------------------------------------------------
bool LISTENER::GetParams(char * buffer, UserData & data)
{
-RS_PACKET_TAIL packetTail;
+RS::PACKET_TAIL packetTail;
Decrypt(&ctxS, (char *)&packetTail, buffer, sizeof(packetTail) / 8);
return true;
}
-std::stringstream params;
+std::ostringstream params;
params << "\"" << data.login << "\" "
<< inet_ntostring(data.ip) << " "
<< data.id << " "
return false;
}
//-----------------------------------------------------------------------------
-bool LISTENER::CheckHeader(const RS_PACKET_HEADER & header) const
+bool LISTENER::CheckHeader(const RS::PACKET_HEADER & header) const
{
if (strncmp((char *)header.magic, RS_ID, RS_MAGIC_LEN))
{