1
0
Fork 0

(svn r21182) -Fix: possible just-freed memory reads

release/1.1
rubidium 2010-11-14 12:05:24 +00:00
parent a9da53c106
commit 673b3711b4
2 changed files with 4 additions and 5 deletions

View File

@ -82,6 +82,8 @@ void NetworkTCPSocketHandler::Send_Packet(Packet *packet)
* data right now (full network-buffer, it happens ;)) * data right now (full network-buffer, it happens ;))
* 3) sending took too long * 3) sending took too long
* @param closing_down Whether we are closing down the connection. * @param closing_down Whether we are closing down the connection.
* @return \c true if a (part of a) packet could be sent and
* the connection is not closed yet.
*/ */
bool NetworkTCPSocketHandler::Send_Packets(bool closing_down) bool NetworkTCPSocketHandler::Send_Packets(bool closing_down)
{ {

View File

@ -138,9 +138,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::CloseConnection(NetworkRecvSta
NetworkClientSocket *cs; NetworkClientSocket *cs;
FOR_ALL_CLIENT_SOCKETS(cs) { FOR_ALL_CLIENT_SOCKETS(cs) {
if (cs->writable) { if (cs->writable) {
cs->Send_Packets(); if (cs->Send_Packets() && cs->status == STATUS_MAP) {
if (cs->status == STATUS_MAP) {
/* This client is in the middle of a map-send, call the function for that */ /* This client is in the middle of a map-send, call the function for that */
cs->SendMap(); cs->SendMap();
} }
@ -451,8 +449,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap()
} }
/* Send all packets (forced) and check if we have send it all */ /* Send all packets (forced) and check if we have send it all */
this->Send_Packets(); if (this->Send_Packets() && this->IsPacketQueueEmpty()) {
if (this->IsPacketQueueEmpty()) {
/* All are sent, increase the sent_packets */ /* All are sent, increase the sent_packets */
sent_packets *= 2; sent_packets *= 2;
} else { } else {