X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f24975b15b40cc3c4b7aa618aeee21cb3cc7e235..6fb0204d71beff637638ef52978df0e8f58453d7:/src/gras/Transport/rl_transport.c diff --git a/src/gras/Transport/rl_transport.c b/src/gras/Transport/rl_transport.c index 4810f8c079..0a702e2dcd 100644 --- a/src/gras/Transport/rl_transport.c +++ b/src/gras/Transport/rl_transport.c @@ -10,8 +10,7 @@ #include "xbt/ex.h" #include "portable.h" #include "gras/Transport/transport_private.h" -XBT_LOG_EXTERNAL_CATEGORY(transport); -XBT_LOG_DEFAULT_CATEGORY(transport); +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_trp); /** * gras_trp_select: @@ -58,9 +57,12 @@ gras_socket_t gras_trp_select(double timeout) { while (done == -1) { if (timeout > 0) { /* did we timeout already? */ now = gras_os_time(); + DEBUG2("wakeup=%f now=%f",wakeup, now); if (now == -1 || now >= wakeup) { - done = 0; /* didn't find anything */ - break; + /* didn't find anything */ + THROW1(timeout_error,0, + "Timeout (%f) elapsed with selecting for incomming connexions", + timeout); } } @@ -105,8 +107,8 @@ gras_socket_t gras_trp_select(double timeout) { if (timeout > 0) { /* set the timeout */ - tout.tv_sec = (unsigned long)((wakeup - now)/1000000); - tout.tv_usec = (unsigned long)(wakeup - now) % 1000000; + tout.tv_sec = (unsigned long)(wakeup - now); + tout.tv_usec = ((wakeup -now) - ((unsigned long)(wakeup - now))) * 1000000; p_tout = &tout; } else if (timeout == 0) { /* polling only */ @@ -120,8 +122,9 @@ gras_socket_t gras_trp_select(double timeout) { p_tout = NULL; } - DEBUG1("Selecting over %d socket(s)", max_fds-1); + DEBUG2("Selecting over %d socket(s); timeout=%f", max_fds-1,timeout); ready = select(max_fds, &FDS, NULL, NULL, p_tout); + DEBUG1("select returned %d", ready); if (ready == -1) { switch (errno) { case EINTR: /* a signal we don't care about occured. we don't care */