mail[Wesnoth-commits] r27057 - /branches/1.4/src/network_worker.cpp


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

Header


Content

Posted by paniemin on June 09, 2008 - 09:29:
Author: suokko
Date: Mon Jun  9 09:29:46 2008
New Revision: 27057

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27057&view=rev
Log:
Fixed timeouts in networking code

Modified:
    branches/1.4/src/network_worker.cpp

Modified: branches/1.4/src/network_worker.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/src/network_worker.cpp?rev=27057&r1=27056&r2=27057&view=diff
==============================================================================
--- branches/1.4/src/network_worker.cpp (original)
+++ branches/1.4/src/network_worker.cpp Mon Jun  9 09:29:46 2008
@@ -290,7 +290,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
        size_t upto = 0;
 
@@ -331,6 +331,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);
@@ -344,7 +349,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);
 
                        
@@ -356,7 +361,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 {
@@ -368,7 +373,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);
@@ -625,7 +630,6 @@
                                result = send_file(sent_buf);
                        } else {
                                if(sent_buf->raw_buffer.empty()) {
-                                       output_to_buffer(sent_buf->sock, 
sent_buf->config_buf, sent_buf->stream, sent_buf->gzipped);
                                        const std::string &value = 
sent_buf->stream.str();
                                        make_network_buffer(value.c_str(), 
value.size(), sent_buf->raw_buffer);
                                } 
@@ -879,8 +883,7 @@
        DBG_NW << "queuing data...\n";
 
        buffer* queued_buf = new buffer(sock);
-       queued_buf->config_buf = buf;
-//     output_to_buffer(sock, buf, queued_buf->stream, gzipped);
+       output_to_buffer(sock, buf, queued_buf->stream, gzipped);
        queued_buf->gzipped = gzipped;
        queue_buffer(sock, queued_buf);
 }




Related Messages


Powered by MHonArc, Updated Mon Jun 09 11:41:20 2008