[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r10232 - GNUnet/src/util/network_client
From: |
gnunet |
Subject: |
[GNUnet-SVN] r10232 - GNUnet/src/util/network_client |
Date: |
Fri, 5 Feb 2010 23:18:47 +0100 |
Author: durner
Date: 2010-02-05 23:18:47 +0100 (Fri, 05 Feb 2010)
New Revision: 10232
Modified:
GNUnet/src/util/network_client/tcpio.c
Log:
make connect timeout 5 seconds on all platforms, keep retry timeout
Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c 2010-02-05 16:48:26 UTC (rev
10231)
+++ GNUnet/src/util/network_client/tcpio.c 2010-02-05 22:18:47 UTC (rev
10232)
@@ -316,11 +316,8 @@
* a connection issue.
*/
#define TRIES_PER_AF 2
-#ifdef WINDOWS
-#define DELAY_PER_RETRY (5000 * GNUNET_CRON_MILLISECONDS)
-#else
+#define CONNECT_TIMEOUT (5 * GNUNET_CRON_SECONDS)
#define DELAY_PER_RETRY (50 * GNUNET_CRON_MILLISECONDS)
-#endif
#define ADVANCE() do { af_index++; tries = TRIES_PER_AF; } while(0)
#define RETRY() do { tries--; if (tries == 0) { ADVANCE(); } else {
GNUNET_thread_sleep(DELAY_PER_RETRY); } } while (0)
tries = TRIES_PER_AF;
@@ -415,8 +412,8 @@
FD_ZERO (&eset);
FD_SET (osock, &wset);
FD_SET (osock, &eset);
- timeout.tv_sec = 0;
- timeout.tv_usec = DELAY_PER_RETRY * TRIES_PER_AF * 1000;
+ timeout.tv_sec = CONNECT_TIMEOUT * TRIES_PER_AF / 1000;
+ timeout.tv_usec = (CONNECT_TIMEOUT * TRIES_PER_AF - timeout.tv_sec *
1000) * 1000;
errno = 0;
select_start = GNUNET_get_time ();
ret = SELECT (osock + 1, &rset, &wset, &eset, &timeout);
@@ -430,7 +427,7 @@
sock->sock = NULL;
GNUNET_mutex_unlock (sock->destroylock);
if ((GNUNET_get_time () - select_start >
- TRIES_PER_AF * DELAY_PER_RETRY) || (errno != EINTR))
+ TRIES_PER_AF * CONNECT_TIMEOUT) || (errno != EINTR))
ADVANCE (); /* spend enough time trying here */
else
RETRY ();
@@ -442,7 +439,7 @@
sock->sock = NULL;
GNUNET_mutex_unlock (sock->destroylock);
if (GNUNET_get_time () - select_start >
- TRIES_PER_AF * DELAY_PER_RETRY)
+ TRIES_PER_AF * CONNECT_TIMEOUT)
ADVANCE (); /* spend enough time trying here */
else
RETRY ();
@@ -462,7 +459,7 @@
sock->sock = NULL;
GNUNET_mutex_unlock (sock->destroylock);
if (GNUNET_get_time () - select_start >
- TRIES_PER_AF * DELAY_PER_RETRY)
+ TRIES_PER_AF * CONNECT_TIMEOUT)
ADVANCE (); /* spend enough time trying here */
else
RETRY ();
@@ -478,6 +475,7 @@
#undef RETRY
#undef TRIES_PER_AF
#undef DELAY_PER_RETRY
+#undef CONNECT_TIMEOUT
return GNUNET_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r10232 - GNUnet/src/util/network_client,
gnunet <=