add set delay for TCP send and receive welcome
authorNathan S. Evans <evans@in.tum.de>
Mon, 11 Jul 2011 12:56:09 +0000 (12:56 +0000)
committerNathan S. Evans <evans@in.tum.de>
Mon, 11 Jul 2011 12:56:09 +0000 (12:56 +0000)
src/transport/gnunet-service-transport.c
src/transport/plugin_transport_tcp.c
src/transport/transport.h

index 4064b97a9e2462f53bc9d5d4657cb6f76872cb33..22a3d58f4d103e2ff0ba123896c8ce9eb13f2b3a 100644 (file)
  */
 #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
  */
index 12c2a1a2f616a2b0d6875f11affbab33bf94b236..0e61d16497c3bab002a9c1ab10232dc672bfbc60 100644 (file)
@@ -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);
 }
 
index 89e50b73f03a0e8d6e5267f2aeb970b9ae715689..1c6aaa2a96ee1608487cba7587cc77fa40a6a12b 100644 (file)
  */
 #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