X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4a201b7ceece70d2bc461ac48c8b746a36d07243..cf57fb58889894670e2594d2e3b6a213d8fd6089:/examples/gras/ping/ping_server.c diff --git a/examples/gras/ping/ping_server.c b/examples/gras/ping/ping_server.c index d867a32958..885b4e5f21 100644 --- a/examples/gras/ping/ping_server.c +++ b/examples/gras/ping/ping_server.c @@ -1,6 +1,7 @@ /* ping - ping/pong demo of GRAS features */ -/* Copyright (c) 2003, 2004, 2005 Martin Quinson. All rights reserved. */ +/* Copyright (c) 2006, 2007, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -30,9 +31,10 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) globals->endcondition = 0; /* 3. Log which client connected */ - INFO3(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<", + XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<", msg, - gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor)); + gras_socket_peer_name(expeditor), + gras_socket_peer_port(expeditor)); /* 4. Change the value of the msg variable */ msg = 4321; @@ -43,10 +45,10 @@ static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload) /* 6. Deal with errors: add some details to the exception */ } CATCH(e) { gras_socket_close(globals->sock); - RETHROW0("Unable answer with PONG: %s"); + RETHROWF("Unable answer with PONG: %s"); } - INFO0(">>>>>>>> Answered with PONG(4321) <<<<<<<<"); + XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<"); /* 7. Set the endcondition boolean to true (and make sure the server stops after receiving it). */ globals->endcondition = 1; @@ -70,7 +72,7 @@ int server(int argc, char *argv[]) port = atoi(argv[1]); } - INFO1("Launch server (port=%d)", port); + XBT_INFO("Launch server (port=%d)", port); /* 3. Create my master socket */ globals->sock = gras_socket_server(port); @@ -83,7 +85,7 @@ int server(int argc, char *argv[]) /* 5. Register my callback */ gras_cb_register("ping", &server_cb_ping_handler); - INFO1(">>>>>>>> Listening on port %d <<<<<<<<", + XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<", gras_socket_my_port(globals->sock)); globals->endcondition = 0; @@ -92,12 +94,13 @@ int server(int argc, char *argv[]) /* 7. Housekeeping */ if (!globals->endcondition) - WARN0("An error occured, the endcondition was not set by the callback"); + XBT_WARN + ("An error occured, the endcondition was not set by the callback"); /* 8. Free the allocated resources, and shut GRAS down */ gras_socket_close(globals->sock); free(globals); - INFO0("Done."); + XBT_INFO("Done."); gras_exit(); return 0;