Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a vicious bug: TCP socket use a buffer and read operation get as much data as...
[simgrid.git] / src / gras / Transport / transport_plugin_tcp.c
index d1c3ef0..b92dccc 100644 (file)
@@ -334,13 +334,12 @@ gras_trp_tcp_recv_withbuffer(gras_socket_t sock,
       bufsize -= status;
       got     += status;
     } else {
-      if (got) 
-        THROW1(system_error,0,"Socket closed by remote side (got %d bytes before this)",
-               got);
-      else
-        return 0; /* Ok, my pal left. I can handle it. */
+      THROW1(system_error,0,"Socket closed by remote side (got %d bytes before this)",
+            got);
     }
   }
+  /* indicate to the gras_select function that there is more to read on this socket so that it does not actually select */
+  sock->moredata = (bufsize != 0);
   return got;
 }