mail[Wesnoth-commits] r37158 - /trunk/src/network.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by kailoran on July 22, 2009 - 16:16:
Author: ilor
Date: Wed Jul 22 15:40:51 2009
New Revision: 37158

URL: http://svn.gna.org/viewcvs/wesnoth?rev=37158&view=rev
Log:
network::accept_connection - only add a socket to pending_sockets if we don't 
intend to close it a second later, add a debug message for one more fail 
condition

Modified:
    trunk/src/network.cpp

Modified: trunk/src/network.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network.cpp?rev=37158&r1=37157&r2=37158&view=diff
==============================================================================
--- trunk/src/network.cpp (original)
+++ trunk/src/network.cpp Wed Jul 22 15:40:51 2009
@@ -510,7 +510,7 @@
        const TCPsocket sock = SDLNet_TCP_Accept(server_socket);
        if(sock) {
                DBG_NW << "received connection. Pending handshake...\n";
-               pending_sockets.push_back(sock);
+
                if(pending_socket_set == 0) {
                        pending_socket_set = SDLNet_AllocSocketSet(32);
                }
@@ -518,13 +518,16 @@
                if(pending_socket_set != 0) {
                        int res = 
SDLNet_TCP_AddSocket(pending_socket_set,sock);
 
-                       if (res == -1)
-                       {
+                       if (res != -1) {
+                               pending_sockets.push_back(sock);
+                       } else {
                                ERR_NW << "Pending socket set is full! 
Disconnecting " << sock << " connection\n";
                                ERR_NW << "SDLNet_GetError() is " << 
SDLNet_GetError() << "\n";
 
                                SDLNet_TCP_Close(sock);
                        }
+               } else {
+                       ERR_NW << "Error in SDLNet_AllocSocketSet\n";
                }
        }
 




Related Messages


Powered by MHonArc, Updated Wed Jul 22 17:01:09 2009