Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
give peer a chance to get the message before closing the socket
[simgrid.git] / examples / gras / rpc / rpc.c
index efb7b8d..94fe661 100644 (file)
@@ -63,11 +63,11 @@ static void exception_catching(void) {
 
 
 int client(int argc,char *argv[]) {
-  xbt_ex_t e; 
+  xbt_ex_t e;
   gras_socket_t toserver=NULL; /* peer */
   gras_socket_t toforwarder=NULL; /* peer */
 
-  
+  memset(&e,0,sizeof(xbt_ex_t));
 
   int ping, pong, i;
   volatile int gotit=0;
@@ -196,6 +196,7 @@ int client(int argc,char *argv[]) {
   
   gras_msg_send(toserver,gras_msgtype_by_name("kill"),NULL);
   gras_msg_send(toforwarder,gras_msgtype_by_name("kill"),NULL);
+  gras_os_sleep(1); /* give peer a chance to get the message before closing the socket */
 
   /* 11. Cleanup the place before leaving */
   gras_socket_close(toserver);