From: Nathan S. Evans Date: Mon, 11 Jul 2011 12:56:09 +0000 (+0000) Subject: add set delay for TCP send and receive welcome X-Git-Tag: initial-import-from-subversion-38251~17911 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c5194eb5e802658e1fab0c4b2be97ba62b42d0fe;p=oweals%2Fgnunet.git add set delay for TCP send and receive welcome --- diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 4064b97a9..22a3d58f4 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -137,16 +137,6 @@ */ #define HELLO_REVALIDATION_START_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1) -/** - * Maximum frequency for re-evaluating latencies for all transport addresses. - */ -#define LATENCY_EVALUATION_MAX_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1) - -/** - * Maximum frequency for re-evaluating latencies for connected addresses. - */ -#define CONNECTED_LATENCY_EVALUATION_MAX_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) - /** * List of addresses of other peers */ diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 12c2a1a2f..0e61d1649 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -42,7 +42,6 @@ #define DEBUG_TCP_NAT GNUNET_NO - /** * Initial handshake message for a session. */ @@ -1191,6 +1190,8 @@ tcp_plugin_send (void *cls, } GNUNET_assert (session != NULL); GNUNET_assert (session->client != NULL); + + GNUNET_SERVER_client_set_timeout(session->client, CONNECTED_LATENCY_EVALUATION_MAX_DELAY); GNUNET_STATISTICS_update (plugin->env->stats, gettext_noop ("# bytes currently in TCP buffers"), msgbuf_size, @@ -1739,6 +1740,7 @@ handle_tcp_welcome (void *cls, } session->last_activity = GNUNET_TIME_absolute_get (); session->expecting_welcome = GNUNET_NO; + GNUNET_SERVER_client_set_timeout(client, CONNECTED_LATENCY_EVALUATION_MAX_DELAY); GNUNET_SERVER_receive_done (client, GNUNET_OK); } diff --git a/src/transport/transport.h b/src/transport/transport.h index 89e50b73f..1c6aaa2a9 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -48,6 +48,16 @@ */ #define MIN_QUOTA_REFRESH_TIME 2000 +/** + * Maximum frequency for re-evaluating latencies for all transport addresses. + */ +#define LATENCY_EVALUATION_MAX_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 1) + +/** + * Maximum frequency for re-evaluating latencies for connected addresses. + */ +#define CONNECTED_LATENCY_EVALUATION_MAX_DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1) + /** * Message from the transport service to the library * asking to check if both processes agree about this