Author: erijo
Date: Mon Oct 25 05:27:55 2010
New Revision: 7948
Log:
White-space changes only
Modified:
trunk/licq/src/icq/threads.cpp
Modified: trunk/licq/src/icq/threads.cpp
==============================================================================
--- trunk/licq/src/icq/threads.cpp (original)
+++ trunk/licq/src/icq/threads.cpp Mon Oct 25 05:27:55 2010
@@ -712,25 +712,25 @@
--nSocketsAvailable;
- // New socket event ----------------------------------------------------
+ // New socket event ----------------------------------------------------
if (nCurrentSocket == gIcqProtocol.myNewSocketPipe.getReadFd())
{
char buf = gIcqProtocol.myNewSocketPipe.getChar();
if (buf == 'S')
{
- DEBUG_THREADS("[MonitorSockets_tep] Reloading socket info.\n");
- }
+ DEBUG_THREADS("[MonitorSockets_tep] Reloading socket info.\n");
+ }
else if (buf == 'X')
{
- DEBUG_THREADS("[MonitorSockets_tep] Exiting.\n");
- return NULL;
- }
- }
-
- // Fifo event ----------------------------------------------------------
+ DEBUG_THREADS("[MonitorSockets_tep] Exiting.\n");
+ return NULL;
+ }
+ }
+
+ // Fifo event ----------------------------------------------------------
if (nCurrentSocket == LicqDaemon::gFifo.fifo_fd)
{
- DEBUG_THREADS("[MonitorSockets_tep] Data on FIFO.\n");
+ DEBUG_THREADS("[MonitorSockets_tep] Data on FIFO.\n");
char buf[1024];
fgets(buf, 1024, LicqDaemon::gFifo.fifo_fs);
LicqDaemon::gFifo.process(buf);
@@ -740,44 +740,44 @@
Licq::INetSocket *s = gSocketManager.FetchSocket(nCurrentSocket);
if (s != NULL && s->userId().isValid() &&
s->userId() == Licq::gUserManager.ownerUserId(LICQ_PPID) &&
- gIcqProtocol.m_nTCPSrvSocketDesc == -1)
- {
- /* This is the server socket and it is about to be destoryed
- so ignore this message (it's probably a disconnection anyway) */
- gSocketManager.DropSocket(s);
- continue;
- }
-
- // Message from the server -------------------------------------------
+ gIcqProtocol.m_nTCPSrvSocketDesc == -1)
+ {
+ /* This is the server socket and it is about to be destoryed
+ so ignore this message (it's probably a disconnection anyway) */
+ gSocketManager.DropSocket(s);
+ continue;
+ }
+
+ // Message from the server -------------------------------------------
if (nCurrentSocket == gIcqProtocol.m_nTCPSrvSocketDesc)
{
- DEBUG_THREADS("[MonitorSockets_tep] Data on TCP server socket.\n");
+ DEBUG_THREADS("[MonitorSockets_tep] Data on TCP server socket.\n");
Licq::SrvSocket* srvTCP = dynamic_cast<Licq::SrvSocket*>(s);
- if (srvTCP == NULL)
- {
- gLog.warning(tr("%sInvalid server socket in set.\n"), L_WARNxSTR);
- close(nCurrentSocket);
+ if (srvTCP == NULL)
+ {
+ gLog.warning(tr("%sInvalid server socket in set.\n"), L_WARNxSTR);
+ close(nCurrentSocket);
continue;
}
- // DAW FIXME error handling when socket is closed..
+ // DAW FIXME error handling when socket is closed..
if (srvTCP->Recv())
{
Licq::Buffer packet(srvTCP->RecvBuffer());
- srvTCP->ClearRecvBuffer();
- gSocketManager.DropSocket(srvTCP);
+ srvTCP->ClearRecvBuffer();
+ gSocketManager.DropSocket(srvTCP);
if (!gIcqProtocol.ProcessSrvPacket(packet))
{} // gIcqProtocol.icqRelogon();
}
- else {
- // probably server closed socket, try to relogon after a while
- // if ping-thread is running already
+ else {
+ // probably server closed socket, try to relogon after a while
+ // if ping-thread is running already
int nSD = gIcqProtocol.m_nTCPSrvSocketDesc;
gIcqProtocol.m_nTCPSrvSocketDesc = -1;
- gLog.info("%sDropping server connection.\n", L_SRVxSTR);
- gSocketManager.DropSocket(srvTCP);
- gSocketManager.CloseSocket(nSD);
- // we need to initialize the logon time for the next retry
+ gLog.info("%sDropping server connection.\n", L_SRVxSTR);
+ gSocketManager.DropSocket(srvTCP);
+ gSocketManager.CloseSocket(nSD);
+ // we need to initialize the logon time for the next retry
gIcqProtocol.m_tLogonTime = time(NULL);
gIcqProtocol.m_eStatus = STATUS_OFFLINE_FORCED;
gIcqProtocol.m_bLoggingOn = false;
@@ -785,10 +785,10 @@
}
}
- // Message from the service sockets -----------------------------------
- else if (nCurrentSocket == nServiceSocket)
- {
- DEBUG_THREADS("[MonitorSockets_tep] Data on BART service socket.\n");
+ // Message from the service sockets -----------------------------------
+ else if (nCurrentSocket == nServiceSocket)
+ {
+ DEBUG_THREADS("[MonitorSockets_tep] Data on BART service socket.\n");
COscarService *svc = gIcqProtocol.m_xBARTService;
Licq::SrvSocket* sock_svc = dynamic_cast<Licq::SrvSocket*>(s);
if (sock_svc == NULL)
@@ -797,86 +797,86 @@
close(nCurrentSocket);
continue;
}
- if (sock_svc->Recv())
- {
+ if (sock_svc->Recv())
+ {
Licq::Buffer packet(sock_svc->RecvBuffer());
- sock_svc->ClearRecvBuffer();
- gSocketManager.DropSocket(sock_svc);
- if (!svc->ProcessPacket(packet))
- {
- gLog.warning(tr("%sCan't process packet for service 0x%02X.\n"),
- L_WARNxSTR, svc->GetFam());
- svc->ResetSocket();
- svc->ChangeStatus(STATUS_UNINITIALIZED);
- gSocketManager.CloseSocket(nCurrentSocket);
- }
- }
- else
- {
- gLog.warning(tr("%sCan't receive packet for service 0x%02X.\n"),
- L_WARNxSTR, svc->GetFam());
- svc->ResetSocket();
- svc->ChangeStatus(STATUS_UNINITIALIZED);
- gSocketManager.DropSocket(sock_svc);
- gSocketManager.CloseSocket(nCurrentSocket);
- }
+ sock_svc->ClearRecvBuffer();
+ gSocketManager.DropSocket(sock_svc);
+ if (!svc->ProcessPacket(packet))
+ {
+ gLog.warning(tr("%sCan't process packet for service 0x%02X.\n"),
+ L_WARNxSTR, svc->GetFam());
+ svc->ResetSocket();
+ svc->ChangeStatus(STATUS_UNINITIALIZED);
+ gSocketManager.CloseSocket(nCurrentSocket);
}
-
- // Connection on the server port -------------------------------------
+ }
+ else
+ {
+ gLog.warning(tr("%sCan't receive packet for service 0x%02X.\n"),
+ L_WARNxSTR, svc->GetFam());
+ svc->ResetSocket();
+ svc->ChangeStatus(STATUS_UNINITIALIZED);
+ gSocketManager.DropSocket(sock_svc);
+ gSocketManager.CloseSocket(nCurrentSocket);
+ }
+ }
+
+ // Connection on the server port -------------------------------------
else if (nCurrentSocket == gIcqProtocol.m_nTCPSocketDesc)
{
- DEBUG_THREADS("[MonitorSockets_tep] Data on listening TCP socket."
- "\n");
+ DEBUG_THREADS("[MonitorSockets_tep] Data on listening TCP socket."
+ "\n");
Licq::TCPSocket* tcp = dynamic_cast<Licq::TCPSocket*>(s);
- if (tcp == NULL)
- {
- gLog.warning(tr("%sInvalid server TCP socket in set.\n"), L_WARNxSTR);
- close(nCurrentSocket);
+ if (tcp == NULL)
+ {
+ gLog.warning(tr("%sInvalid server TCP socket in set.\n"), L_WARNxSTR);
+ close(nCurrentSocket);
continue;
}
Licq::TCPSocket* newSocket = new Licq::TCPSocket();
- bool ok = tcp->RecvConnection(*newSocket);
- gSocketManager.DropSocket(tcp);
-
- // Make sure we can handle another socket before accepting it
- if (!ok || gSocketManager.Num() > MAX_CONNECTS)
- {
- // Too many sockets, drop this one
- gLog.warning(tr("%sToo many connected sockets, rejecting connection from %s.\n"),
- L_WARNxSTR, newSocket->getRemoteIpString().c_str());
- delete newSocket;
- }
- else
- {
- gSocketManager.AddSocket(newSocket);
- gSocketManager.DropSocket(newSocket);
- }
- }
-
- // Message from connected socket--------------------------------------
+ bool ok = tcp->RecvConnection(*newSocket);
+ gSocketManager.DropSocket(tcp);
+
+ // Make sure we can handle another socket before accepting it
+ if (!ok || gSocketManager.Num() > MAX_CONNECTS)
+ {
+ // Too many sockets, drop this one
+ gLog.warning(tr("%sToo many connected sockets, rejecting connection from %s.\n"),
+ L_WARNxSTR, newSocket->getRemoteIpString().c_str());
+ delete newSocket;
+ }
+ else
+ {
+ gSocketManager.AddSocket(newSocket);
+ gSocketManager.DropSocket(newSocket);
+ }
+ }
+
+ // Message from connected socket--------------------------------------
+ else
+ {
+ DEBUG_THREADS("[MonitorSockets_tep] Data on TCP user socket.\n");
+
+ ssl_recv:
+
+ Licq::TCPSocket* tcp = dynamic_cast<Licq::TCPSocket*>(s);
+
+ // If tcp is NULL then the socket is no longer in the set, hence it
+ // must have been closed by us and we can ignore it.
+ if (tcp == NULL)
+ continue;
+
+ if (!tcp->RecvPacket())
+ {
+ int err = tcp->Error();
+ if (err == 0)
+ gLog.info(tr("%sConnection to %s was closed.\n"), L_TCPxSTR,
+ tcp->userId().toString().c_str());
else
- {
- DEBUG_THREADS("[MonitorSockets_tep] Data on TCP user socket.\n");
-
- ssl_recv:
-
- Licq::TCPSocket* tcp = dynamic_cast<Licq::TCPSocket*>(s);
-
- // If tcp is NULL then the socket is no longer in the set, hence it
- // must have been closed by us and we can ignore it.
- if (tcp == NULL)
- continue;
-
- if (!tcp->RecvPacket())
- {
- int err = tcp->Error();
- if (err == 0)
- gLog.info(tr("%sConnection to %s was closed.\n"), L_TCPxSTR,
- tcp->userId().toString().c_str());
- else
- gLog.info(tr("%sConnection to %s lost:\n%s%s.\n"), L_TCPxSTR,
- tcp->userId().toString().c_str(), L_BLANKxSTR, tcp->errorStr().c_str());
+ gLog.info(tr("%sConnection to %s lost:\n%s%s.\n"), L_TCPxSTR,
+ tcp->userId().toString().c_str(), L_BLANKxSTR, tcp->errorStr().c_str());
if (tcp->userId().isValid())
{
Licq::UserWriteGuard u(tcp->userId());
@@ -888,44 +888,44 @@
Licq::PluginSignal::UserSecurity, u->id(), 0));
}
}
- gSocketManager.DropSocket(tcp);
- gSocketManager.CloseSocket(nCurrentSocket);
+ gSocketManager.DropSocket(tcp);
+ gSocketManager.CloseSocket(nCurrentSocket);
gIcqProtocol.FailEvents(nCurrentSocket, err);
- break;
- }
-
- // Save the bytes pending status of the socket
- bool bPending = tcp->SSL_Pending();
- bool r = true;
-
- // Process the packet if the buffer is full
- if (tcp->RecvBufferFull())
- {
+ break;
+ }
+
+ // Save the bytes pending status of the socket
+ bool bPending = tcp->SSL_Pending();
+ bool r = true;
+
+ // Process the packet if the buffer is full
+ if (tcp->RecvBufferFull())
+ {
if (tcp->userId().protocolId() != LICQ_PPID)
r = gIcqProtocol.ProcessTcpHandshake(tcp);
else
r = gIcqProtocol.ProcessTcpPacket(tcp);
- tcp->ClearRecvBuffer();
- }
-
- // Kill the socket if there was a problem
- if (!r)
- {
- gLog.info(tr("%sClosing connection to %s.\n"), L_TCPxSTR,
- tcp->userId().toString().c_str());
- gSocketManager.DropSocket(tcp);
- gSocketManager.CloseSocket(nCurrentSocket);
+ tcp->ClearRecvBuffer();
+ }
+
+ // Kill the socket if there was a problem
+ if (!r)
+ {
+ gLog.info(tr("%sClosing connection to %s.\n"), L_TCPxSTR,
+ tcp->userId().toString().c_str());
+ gSocketManager.DropSocket(tcp);
+ gSocketManager.CloseSocket(nCurrentSocket);
gIcqProtocol.FailEvents(nCurrentSocket, 0);
- bPending = false;
- }
- else
- {
- gSocketManager.DropSocket(tcp);
- }
-
- // If there is more data pending then go again
- if (bPending) goto ssl_recv;
+ bPending = false;
+ }
+ else
+ {
+ gSocketManager.DropSocket(tcp);
+ }
+
+ // If there is more data pending then go again
+ if (bPending) goto ssl_recv;
}
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.