Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
on exit, close all the sockets left open and others leak plugs
[simgrid.git] / src / gras / Msg / msg.c
index 777fcd0..e705dbc 100644 (file)
@@ -43,6 +43,8 @@ static void gras_msg_procdata_free(void *data) {
    xbt_dynar_free(&( res->msg_queue ));
    xbt_dynar_free(&( res->cbl_list ));
    xbt_dynar_free(&( res->timers ));
+   
+   free(res);
 }
 
 /*
@@ -139,10 +141,7 @@ gras_msgtype_declare_v(const char           *name,
   xbt_error_t   errcode;
   gras_msgtype_t msgtype;
   char *namev=make_namev(name,version);
-   
-  if (!payload) 
-     WARN1("Message %s has NULL payload",name);
-   
+      
   errcode = xbt_set_get_by_name(_gras_msgtype_set,
                                 namev,(xbt_set_elm_t*)&msgtype);
 
@@ -249,7 +248,7 @@ gras_msg_recv(gras_socket_t    sock,
   TRY(gras_trp_chunk_recv(sock, header, 6));
   for (cpt=0; cpt<4; cpt++)
     if (header[cpt] != GRAS_header[cpt])
-      RAISE0(mismatch_error,"Incoming bytes do not look like a GRAS message");
+      RAISE2(mismatch_error,"Incoming bytes do not look like a GRAS message (header='%.4s' not '%.4s')",header,GRAS_header);
   if (header[4] != GRAS_header[4]) 
     RAISE2(mismatch_error,"GRAS protocol mismatch (got %d, use %d)",
           (int)header[4], (int)GRAS_header[4]);
@@ -311,7 +310,7 @@ gras_msg_wait(double           timeout,
     RAISE0(mismatch_error,
           "Cannot wait for the NULL message (did msgtype_by_name fail?)");
 
-  VERB1("Waiting for message %s",msgt_want->name);
+  VERB1("Waiting for message '%s'",msgt_want->name);
 
   start = now = gras_os_time();
 
@@ -483,7 +482,7 @@ gras_cb_register(gras_msgtype_t msgtype,
   gras_cblist_t *list=NULL;
   int cpt;
 
-  DEBUG2("Register %p as callback to %s",cb,msgtype->name);
+  DEBUG2("Register %p as callback to '%s'",cb,msgtype->name);
 
   /* search the list of cb for this message on this host (creating if NULL) */
   xbt_dynar_foreach(pd->cbl_list,cpt,list) {