X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/8a6bb3ec35a4d3ebc36ef08cc6dcdfcec51de572..037955e458fb05c8ad1a1bdc3509bac0664f87a2:/examples/gras/mutual_exclusion/simple_token/simple_token.c diff --git a/examples/gras/mutual_exclusion/simple_token/simple_token.c b/examples/gras/mutual_exclusion/simple_token/simple_token.c index 0ad688f461..5f0db6902a 100644 --- a/examples/gras/mutual_exclusion/simple_token/simple_token.c +++ b/examples/gras/mutual_exclusion/simple_token/simple_token.c @@ -72,8 +72,7 @@ static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload) { /* 5. Send the token as payload of a stoken message to the successor */ TRY { - gras_msg_send(globals->tosuccessor, - gras_msgtype_by_name("stoken"), &msg); + gras_msg_send(globals->tosuccessor, "stoken", &msg); /* 6. Deal with errors */ } CATCH(e) { @@ -96,7 +95,7 @@ static int node_cb_stoken_handler(gras_msg_cb_ctx_t ctx, void *payload) { } /* 9. Tell GRAS that we consummed this message */ - return 1; + return 0; } /* end_of_node_cb_stoken_handler */ int node (int argc,char *argv[]) { @@ -130,7 +129,7 @@ int node (int argc,char *argv[]) { globals->tosuccessor = NULL; if (!gras_os_getpid() % 100) - INFO4("Launch node %ld (successor on %s:%d; listening on %d)", + INFO4("Launch node %d (successor on %s:%d; listening on %d)", gras_os_getpid(), host,peerport, myport); /* 4. Create my master socket for listening */ @@ -150,7 +149,7 @@ int node (int argc,char *argv[]) { /* 8. One node has to create the token at startup. It's specified by a command line argument */ - if (argc >= 5 && !strncmp("--create-token", argv[4],strlen(argv[4]))) + if (argc >= 5 && !strncmp("--create-token", argv[4],strlen("--create-token"))) globals->create=1; if (globals->create) { @@ -162,8 +161,7 @@ int node (int argc,char *argv[]) { token, host, peerport); TRY { - gras_msg_send(globals->tosuccessor, - gras_msgtype_by_name("stoken"), &token); + gras_msg_send(globals->tosuccessor, "stoken", &token); } CATCH(e) { RETHROW0("Unable to send the freshly created token: %s"); }