Revision: 1375
http://planeshift.svn.sourceforge.net/planeshift/?rev=1375&view=rev
Author: khakilord
Date: 2008-04-21 05:40:48 -0700 (Mon, 21 Apr 2008)
Log Message:
-----------
Fixed crash when printing ip address during error. Fixed problem with dropping high priority messages by blocking when the message queue is full.
Modified Paths:
--------------
stable/src/common/net/netbase.cpp
Modified: stable/src/common/net/netbase.cpp
===================================================================
--- stable/src/common/net/netbase.cpp 2008-04-21 01:21:29 UTC (rev 1374)
+++ stable/src/common/net/netbase.cpp 2008-04-21 12:40:48 UTC (rev 1375)
@@ -172,6 +172,17 @@
psNetPacket *bufpacket = psNetPacket::NetPacketFromBuffer(input_buffer,packetlen);
if (bufpacket==NULL)
{
+ unsigned int a1,a2,a3,a4;
+#ifdef WIN32
+ unsigned long a = addr.sin_addr.S_un.S_addr;
+#else
+ unsigned long a = addr.sin_addr.s_addr;
+#endif
+
+ a1 = a&0x000000FF;
+ a2 = (a&0x0000FF00)>>8;
+ a3 = (a&0x00FF0000)>>16;
+ a4 = (a&0xFF000000)>>24;
// The data received was too small to make a full packet.
if (connection)
{
@@ -181,7 +192,7 @@
{
unsigned char *ip_bytes=(unsigned char *)(&(addr.sin_addr));
Debug6(LOG_NET,0,"Too short packet received from IP address %d.%d.%d.%d. (%d bytes) No existing connection from this IP.\n",
- (int)ip_bytes[0],(int)ip_bytes[1],(int)ip_bytes[2],(int)ip_bytes[3],packetlen);
+ a1, a2, a3, a4,packetlen);
}
return true; // Continue processing more packets if available
}
@@ -193,6 +204,17 @@
// Check for too-big packets - no harm in processing them, but probably a bug somewhere
if (bufpacket->GetPacketSize() < (unsigned int)packetlen)
{
+ unsigned int a1,a2,a3,a4;
+#ifdef WIN32
+ unsigned long a = addr.sin_addr.S_un.S_addr;
+#else
+ unsigned long a = addr.sin_addr.s_addr;
+#endif
+
+ a1 = a&0x000000FF;
+ a2 = (a&0x0000FF00)>>8;
+ a3 = (a&0x00FF0000)>>16;
+ a4 = (a&0xFF000000)>>24;
if (connection)
{
Debug4(LOG_NET,connection->clientnum,"Too long packet received from client %d (%d bytes received, header reports %zu bytes)\n",
@@ -202,8 +224,8 @@
{
unsigned char *ip_bytes=(unsigned char *)(&(addr.sin_addr));
pslog::LogMessage (__FILE__, __LINE__, __FUNCTION__,CS_REPORTER_SEVERITY_DEBUG, LOG_NET,
- connection->clientnum,"Too long packet received from IP address %d.%d.%d.%d. (%d bytes received, header reports %zu bytes) No existing connection from this IP.\n",
- (int)ip_bytes[0],(int)ip_bytes[1],(int)ip_bytes[2],(int)ip_bytes[3],packetlen,bufpacket->GetPacketSize());
+ 0,"Too long packet received from IP address %d.%d.%d.%d. (%d bytes received, header reports %zu bytes) No existing connection from this IP.\n",
+ a1, a2, a3, a4,packetlen,bufpacket->GetPacketSize());
}
}
@@ -1090,12 +1112,8 @@
// Input queue is full. Yield CPU and check back if it still is full
CS::Threading::Thread::Yield();
- if (!inqueues[i]->Add(me))
- {
- Error4("*** Input Buffer Full! Yielding for packet, client %u, type %s, input queue %zu!",
- me->clientnum,GetMsgTypeName(me->GetType()).GetData(),i);
- netInfos.droppedPackets++;
- }
+
+ CS_ASSERT(inqueues[i]->AddWait(me));
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|