Public feed
#887266
Index: src/game/WorldSocket.cpp
===================================================================
--- src/game/WorldSocket.cpp (revision 5120)
+++ src/game/WorldSocket.cpp (working copy)
@@ -97,9 +97,29 @@
/// Copy the packet to the to-be-sent queue
void WorldSocket::SendPacket(WorldPacket* packet)
{
- WorldPacket *pck = new WorldPacket(*packet);
+ // if packet is 0x0
+ if(!packet)
+ {
+ sLog.outError("In WorldSocket::SendPacket get Exeption. Argument packet is NULL");
+ return;
+ }
+ // if Add send packet to "Dead" session
+ if(!GetSession())
+ {
+ sLog.outError("In WorldSocket::SendPacket get Exeption. Session is dead");
+ return;
+ }
+ WorldPacket *pck = new WorldPacket(*packet);
ASSERT(pck);
+ if(!pck->empty())
_sendQueue.add(pck);
+ // created pck without data. Its empty?
+ else
+ {
+ sLog.outError("In WorldSocket::SendPacket get Exeption. Packet is creaded IsEmpty");
+ pck->clear();
+ delete pck;
+ }
}
/// On client connection
Index: src/game/WorldSocketMgr.cpp
===================================================================
--- src/game/WorldSocketMgr.cpp (revision 5120)
+++ src/game/WorldSocketMgr.cpp (working copy)
@@ -24,6 +24,7 @@
#include "WorldSocket.h"
#include "WorldSocketMgr.h"
#include "Policies/SingletonImp.h"
+#include "Log.h"
INSTANTIATE_SINGLETON_1( WorldSocketMgr );
@@ -50,6 +51,8 @@
SocketSet::iterator i;
for(i = m_sockets.begin(); i != m_sockets.end(); i++)
{
- (*i)->Update(diff);
+ if((*i)->IsConnected())
+ (*i)->Update(diff);
+ else sLog.outError("WorldSocketMgr::Update attemp to update disconected sockets, crash?");
}
}