From 206f67a04d1740ae7345bd940fe00547f2fc2eaa Mon Sep 17 00:00:00 2001 From: mquinson Date: Fri, 13 Jul 2007 08:54:26 +0000 Subject: [PATCH] reduce the waiting time in RL on make check git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3758 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/gras/ping/ping_client.c | 18 +++++++++++++----- examples/gras/ping/test_rl | 2 -- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/gras/ping/ping_client.c b/examples/gras/ping/ping_client.c index c49642463c..6230b70c36 100644 --- a/examples/gras/ping/ping_client.c +++ b/examples/gras/ping/ping_client.c @@ -13,6 +13,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(Ping); int client(int argc,char *argv[]) { xbt_ex_t e; gras_socket_t toserver=NULL; /* peer */ + int connected = 0; gras_socket_t from; int ping, pong; @@ -35,13 +36,20 @@ int client(int argc,char *argv[]) { gras_os_sleep(1); /* 4. Create a socket to speak to the server */ - TRY { - toserver=gras_socket_client(host,port); - } CATCH(e) { - RETHROW0("Unable to connect to the server: %s"); + while (!connected) { + TRY { + toserver=gras_socket_client(host,port); + connected = 1; + } CATCH(e) { + if (e.category != system_error) + /* dunno what happened, let the exception go through */ + RETHROW0("Unable to connect to the server: %s"); + xbt_ex_free(e); + gras_os_sleep(0.05); + } } - INFO2("Connected to %s:%d.",host,port); + INFO2("Connected to %s:%d.",host,port); /* 5. Register the messages. See, it doesn't have to be done completely at the beginning, only before use */ diff --git a/examples/gras/ping/test_rl b/examples/gras/ping/test_rl index 41f467939a..a36a84cd8a 100755 --- a/examples/gras/ping/test_rl +++ b/examples/gras/ping/test_rl @@ -10,8 +10,6 @@ > Done. > Exiting GRAS -$ sleep 1 - #! set timeout 20 & $SG_TEST_ENV ./ping_client$EXEEXT 127.0.0.1 4002 --log=root.fmt=%m%n > Launch client (server on 127.0.0.1:4002) -- 2.20.1