mail[Wesnoth-commits] r27084 - /trunk/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 10, 2008 - 13:35:
Author: suokko
Date: Tue Jun 10 13:35:31 2008
New Revision: 27084

URL: http://svn.gna.org/viewcvs/wesnoth?rev=27084&view=rev
Log:
Made send_file to check return code

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=27084&r1=27083&r2=27084&view=diff
==============================================================================
--- trunk/src/network_worker.cpp (original)
+++ trunk/src/network_worker.cpp Tue Jun 10 13:35:31 2008
@@ -420,7 +420,10 @@
                poll_res = poll(&fd, 1, 600000);
        } while(poll_res == -1 && errno == EINTR);
 
-       SOCKET_STATE result = send_buffer(buf->sock, buffer, 4);
+       if (poll_res > 0)
+               SOCKET_STATE result = send_buffer(buf->sock, buffer, 4);
+       else
+               result = SOCKET_ERRORED;
        
        
        if (result != SOCKET_READY)
@@ -458,6 +461,13 @@
 
                int bytes = ::sendfile(socket, in_file, 0, filesize);
 
+               if (bytes == -1)
+               {
+                       if (errno == EAGAIN)
+                               continue;
+                       result = SOCKET_ERRORED;
+                       break;
+               }
                upto += bytes;
 
 




Related Messages


Powered by MHonArc, Updated Tue Jun 10 13:41:02 2008