A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix search paths for test "simdag-test-lua".
[simgrid.git]
/
examples
/
gras
/
console
/
ping_server.c
diff --git
a/examples/gras/console/ping_server.c
b/examples/gras/console/ping_server.c
index
64819df
..
f1324b1
100644
(file)
--- a/
examples/gras/console/ping_server.c
+++ b/
examples/gras/console/ping_server.c
@@
-12,18
+12,16
@@
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping);
/* Global private data */
typedef struct {
/* Global private data */
typedef struct {
-
gras
_socket_t sock;
+
xbt
_socket_t sock;
int endcondition;
} server_data_t;
static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
{
int endcondition;
} server_data_t;
static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
{
-
- xbt_ex_t e;
/* 1. Get the payload into the msg variable, and retrieve my caller */
int msg = *(int *) payload;
/* 1. Get the payload into the msg variable, and retrieve my caller */
int msg = *(int *) payload;
-
gras
_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+
xbt
_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
/* 2. Retrieve the server's state (globals) */
/* 2. Retrieve the server's state (globals) */
@@
-33,8
+31,8
@@
static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
/* 3. Log which client connected */
XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
msg,
/* 3. Log which client connected */
XBT_INFO(">>>>>>>> Got message PING(%d) from %s:%d <<<<<<<<",
msg,
-
gras
_socket_peer_name(expeditor),
-
gras
_socket_peer_port(expeditor));
+
xbt
_socket_peer_name(expeditor),
+
xbt
_socket_peer_port(expeditor));
/* 4. Change the value of the msg variable */
msg = 4321;
/* 4. Change the value of the msg variable */
msg = 4321;
@@
-43,9
+41,10
@@
static int server_cb_ping_handler(gras_msg_cb_ctx_t ctx, void *payload)
gras_msg_send(expeditor, "pong", &msg);
/* 6. Deal with errors: add some details to the exception */
gras_msg_send(expeditor, "pong", &msg);
/* 6. Deal with errors: add some details to the exception */
- } CATCH(e) {
+ }
+ CATCH_ANONYMOUS {
gras_socket_close(globals->sock);
gras_socket_close(globals->sock);
- RETHROW
0
("Unable answer with PONG: %s");
+ RETHROW
F
("Unable answer with PONG: %s");
}
XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
}
XBT_INFO(">>>>>>>> Answered with PONG(4321) <<<<<<<<");
@@
-86,10
+85,10
@@
int server(int argc, char *argv[])
gras_cb_register("ping", &server_cb_ping_handler);
XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<",
gras_cb_register("ping", &server_cb_ping_handler);
XBT_INFO(">>>>>>>> Listening on port %d <<<<<<<<",
-
gras
_socket_my_port(globals->sock));
+
xbt
_socket_my_port(globals->sock));
globals->endcondition = 0;
globals->endcondition = 0;
- /* 6. Wait up to 20 minutes for an incom
m
ing message to handle */
+ /* 6. Wait up to 20 minutes for an incoming message to handle */
gras_msg_handle(20.0);
/* 7. Housekeeping */
gras_msg_handle(20.0);
/* 7. Housekeeping */