Author: suokko
Date: Tue Jun 10 09:20:23 2008
New Revision: 27079

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27079&view=rev
Log:
Fixed timeouts when sending network data

Modified:
    trunk/src/network_worker.cpp

Modified: trunk/src/network_worker.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_worker.cpp?rev=27079&r1=27078&r2=27079&view=diff
==============================================================================
--- trunk/src/network_worker.cpp (original)
+++ trunk/src/network_worker.cpp Tue Jun 10 09:20:23 2008
@@ -305,7 +305,7 @@
 static SOCKET_STATE send_buffer(TCPsocket sock, std::vector<char>& buf, int 
in_size = -1)
 {
 #ifdef __BEOS__
-       int timeout = 15000;
+       int timeout = 60000;
 #endif
 //     check_send_buffer_size(sock);
        size_t upto = 0;
@@ -345,7 +345,11 @@
                        }
                        return SOCKET_READY;
                }
-       
+#if defined(EAGAIN) && !defined(__BEOS__) && !defined(_WIN32)
+               if(errno == EAGAIN)
+#elif defined(EWOULDBLOCK)
+               if(errno == EWOULDBLOCK)
+#endif
                {
                        // update how far we are
                        upto += static_cast<size_t>(res);
@@ -359,7 +363,7 @@
                        struct pollfd fd = { ((_TCPsocket*)sock)->channel, 
POLLOUT, 0 };
                        int poll_res;
                        do {
-                               poll_res = poll(&fd, 1, 15000);
+                               poll_res = poll(&fd, 1, 60000);
                        } while(poll_res == -1 && errno == EINTR);
 
                        
@@ -371,7 +375,7 @@
                        FD_SET(((_TCPsocket*)sock)->channel, &writefds);
                        int retval;
                        struct timeval tv;
-                       tv.tv_sec = 15;
+                       tv.tv_sec = 60;
                        tv.tv_usec = 0;
 
                        do {
@@ -383,7 +387,7 @@
 #elif defined(__BEOS__)
                        if(res > 0) {
                                // some data was sent, reset timeout
-                               timeout = 15000;
+                               timeout = 60000;
                        } else {
                                // sleep for 100 milliseconds
                                SDL_Delay(100);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to