Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use format precision modifier in date outputs, since some of the GRAS messages are...
[simgrid.git] / examples / gras / ping / ping_server.c
index 1a6c7e8..1fd2a7a 100644 (file)
@@ -39,7 +39,7 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) {
   msg = 4321;
   /* 5. Send it back as payload of a pong message to the expeditor */
   TRY {
-    gras_msg_send(expeditor, gras_msgtype_by_name("pong"), &msg);
+    gras_msg_send(expeditor, "pong", &msg);
 
   /* 6. Deal with errors: add some details to the exception */
   } CATCH(e) {
@@ -56,7 +56,7 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) {
   gras_socket_close(expeditor);
    
   /* 9. Tell GRAS that we consummed this message */
-  return 1;
+  return 0;
 } /* end_of_server_cb_ping_handler */
 
 int server (int argc,char *argv[]) {
@@ -84,7 +84,7 @@ int server (int argc,char *argv[]) {
   ping_register_messages(); /* just to make sure it works ;) */
    
   /* 5. Register my callback */
-  gras_cb_register(gras_msgtype_by_name("ping"),&server_cb_ping_handler);
+  gras_cb_register("ping",&server_cb_ping_handler);
 
   INFO1(">>>>>>>> Listening on port %d <<<<<<<<", gras_socket_my_port(globals->sock));
   globals->endcondition=0;
@@ -99,8 +99,8 @@ int server (int argc,char *argv[]) {
   /* 8. Free the allocated resources, and shut GRAS down */
   gras_socket_close(globals->sock);
   free(globals);
+  INFO0("Done.");
   gras_exit();
    
-  INFO0("Done.");
   return 0;
 } /* end_of_server */