From 214d4593f9a407095fa0c07b0e8299bfeeb1c40b Mon Sep 17 00:00:00 2001 From: mquinson Date: Thu, 13 Apr 2006 12:37:31 +0000 Subject: [PATCH] setup the select() timeout correctly, some more debugging logs git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2149 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/gras/Transport/rl_transport.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gras/Transport/rl_transport.c b/src/gras/Transport/rl_transport.c index 4810f8c079..f32e5981e2 100644 --- a/src/gras/Transport/rl_transport.c +++ b/src/gras/Transport/rl_transport.c @@ -58,6 +58,7 @@ 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; @@ -105,8 +106,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 +121,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 */ -- 2.20.1