Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make sure that we won't try to reuse a socket closed by the user, even if we have...
[simgrid.git] / src / gras / Transport / transport.c
index 476780f..d763d93 100644 (file)
@@ -160,6 +160,7 @@ void gras_trp_socket_new(int incoming,
   sock->meas = 0;
   sock->recv_ok = 1;
   sock->valid = 1;
+  sock->moredata = 0;
 
   sock->sd     = -1;
   sock->port      = -1;
@@ -344,6 +345,12 @@ void gras_socket_close(gras_socket_t sock) {
 
   XBT_IN;
   VERB1("Close %p",sock);
+  if (sock == _gras_lastly_selected_socket) {
+     if (sock->moredata) 
+       CRITICAL0("Closing a socket which had another message buffered after the one being handled now. Go fix your code.");
+     _gras_lastly_selected_socket=NULL;
+  }
+   
   /* FIXME: Issue an event when the socket is closed */
   if (sock) {
     xbt_dynar_foreach(sockets,cursor,sock_iter) {