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
merge branches
[simgrid.git]
/
examples
/
gras
/
p2p
/
can
/
can_tests.c
diff --git
a/examples/gras/p2p/can/can_tests.c
b/examples/gras/p2p/can/can_tests.c
index
6997622
..
44a7227
100644
(file)
--- a/
examples/gras/p2p/can/can_tests.c
+++ b/
examples/gras/p2p/can/can_tests.c
@@
-27,7
+27,6
@@
int start_war(int argc, char **argv)
{
gras_socket_t temp_sock = NULL;
nuke_t nuke_msg;
- xbt_ex_t e; // the error variable used in TRY.. CATCH tokens.
//return 0; // in order to inhibit the War of the Nodes
gras_init(&argc, argv);
gras_os_sleep((15 - gras_os_getpid()) * 20 + 200); // wait a bit.
@@
-35,8
+34,9
@@
int start_war(int argc, char **argv)
TRY { // contacting the bad guy that will launch the War.
temp_sock = gras_socket_client(gras_os_myname(), atoi(argv[1]));
- } CATCH(e) {
- RETHROW0("Unable to connect known host so as to declare WAR!: %s");
+ }
+ CATCH_ANONYMOUS {
+ RETHROWF("Unable to connect known host so as to declare WAR!: %s");
}
@@
-48,9
+48,10
@@
int start_war(int argc, char **argv)
TRY {
gras_msg_send(temp_sock, "can_nuke", &nuke_msg);
- } CATCH(e) {
+ }
+ CATCH_ANONYMOUS {
gras_socket_close(temp_sock);
- RETHROW
0
+ RETHROW
F
("Unable to contact known host so as to declare WAR!!!!!!!!!!!!!!!!!!!!!: %s");
}
gras_socket_close(temp_sock); // spare.
@@
-63,7
+64,6
@@
static int send_nuke(nuke_t * msg, int xId, int yId)
{
node_data_t *globals = (node_data_t *) gras_userdata_get();
gras_socket_t temp_sock = NULL;
- xbt_ex_t e; // the error variable used in TRY.. CATCH tokens.
if (xId >= globals->x1 && xId <= globals->x2 && yId >= globals->y1
&& yId <= globals->y2) {
@@
-95,15
+95,15
@@
static int send_nuke(nuke_t * msg, int xId, int yId)
TRY { // sending the nuke.
temp_sock = gras_socket_client(host, port);
}
- CATCH
(e)
{
- RETHROW
0
("Unable to connect the nuke!: %s");
+ CATCH
_ANONYMOUS
{
+ RETHROW
F
("Unable to connect the nuke!: %s");
}
//XBT_INFO("%s ON %s %d %d <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<",globals->host,host,xId,yId);
TRY {
gras_msg_send(temp_sock, "can_nuke", msg);
}
- CATCH
(e)
{
- RETHROW
0
("Unable to send the nuke!: %s");
+ CATCH
_ANONYMOUS
{
+ RETHROW
F
("Unable to send the nuke!: %s");
}
gras_socket_close(temp_sock);
XBT_INFO("Nuke launched by %s to %s for (%d;%d)", globals->host, host,
@@
-190,14
+190,14
@@
static int node_nuke_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
TRY {
temp_sock = gras_socket_client(host, port);
}
- CATCH
(e)
{
- RETHROW
0
("Unable to connect the nuke!: %s");
+ CATCH
_ANONYMOUS
{
+ RETHROW
F
("Unable to connect the nuke!: %s");
}
TRY {
gras_msg_send(temp_sock, "can_nuke", incoming);
}
- CATCH
(e)
{
- RETHROW
0
("Unable to send the nuke!: %s");
+ CATCH
_ANONYMOUS
{
+ RETHROW
F
("Unable to send the nuke!: %s");
}
XBT_INFO("Nuke re-aimed by %s to %s for (%d;%d)", globals->host, host,
incoming->xId, incoming->yId);
@@
-212,6
+212,7
@@
static int node_nuke_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
XBT_INFO("My area is [%d;%d;%d;%d]", globals->x1, globals->x2,
globals->y1, globals->y2);
//XBT_INFO("Closing node, all has been done!");
+ xbt_ex_free(e);
}
return 0;
}