gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13778 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r13778 - gnunet/src/core
Date: Mon, 22 Nov 2010 23:53:51 +0100

Author: grothoff
Date: 2010-11-22 23:53:51 +0100 (Mon, 22 Nov 2010)
New Revision: 13778

Modified:
   gnunet/src/core/gnunet-service-core.c
Log:
initialize uninit

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2010-11-22 22:32:12 UTC (rev 
13777)
+++ gnunet/src/core/gnunet-service-core.c       2010-11-22 22:53:51 UTC (rev 
13778)
@@ -860,6 +860,21 @@
 
 
 /**
+ * At what time should the connection to the given neighbour
+ * time out (given no further activity?)
+ *
+ * @param n neighbour in question
+ * @return absolute timeout
+ */
+static struct GNUNET_TIME_Absolute 
+get_neighbour_timeout (struct Neighbour *n)
+{
+  return GNUNET_TIME_absolute_add (n->last_activity,
+                                  GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+}
+
+
+/**
  * A preference value for a neighbour was update.  Update
  * the preference sum accordingly.
  *
@@ -991,8 +1006,7 @@
   psnm.ats_count = htonl (0);
   psnm.ats.type = htonl (0);
   psnm.ats.value = htonl (0);
-  psnm.timeout = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_add 
(n->last_activity,
-                                                                     
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
+  psnm.timeout = GNUNET_TIME_absolute_hton (get_neighbour_timeout (n));
   psnm.bandwidth_in = n->bw_in;
   psnm.bandwidth_out = n->bw_out;
   psnm.peer = n->peer;
@@ -1663,8 +1677,7 @@
               ((void *) &pm->target - (void *) pm));
   process_encrypted_neighbour_queue (n);
   /* reschedule PING job */
-  left = GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_add 
(n->last_activity,
-                                                                      
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
+  left = GNUNET_TIME_absolute_get_remaining (get_neighbour_timeout (n));
   retry = GNUNET_TIME_relative_max (GNUNET_TIME_relative_divide (left, 2),
                                    MIN_PING_FREQUENCY);
   n->keep_alive_task 
@@ -1710,8 +1723,7 @@
        (GNUNET_YES == n->is_connected) )
     return; /* no chance */
     
-  left = GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_add 
(n->last_activity,
-                                                                      
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
+  left = GNUNET_TIME_absolute_get_remaining (get_neighbour_timeout (n));
   if (left.rel_value > 0)
     {
       if (n->dead_clean_task != GNUNET_SCHEDULER_NO_TASK)
@@ -3382,7 +3394,10 @@
         }      
       cnm.header.size = htons (sizeof (struct ConnectNotifyMessage));
       cnm.header.type = htons (GNUNET_MESSAGE_TYPE_CORE_NOTIFY_CONNECT);
+      cnm.ats_count = htonl (0);
       cnm.peer = n->peer;
+      cnm.ats.type = htonl (0);
+      cnm.ats.value = htonl (0);
       send_to_all_clients (&cnm.header, GNUNET_NO, 
GNUNET_CORE_OPTION_SEND_CONNECT);
       process_encrypted_neighbour_queue (n);
       /* fall-through! */
@@ -4047,7 +4062,7 @@
   else
     q_in = GNUNET_BANDWIDTH_value_init (need_per_peer + (uint32_t) share);
   /* check if we want to disconnect for good due to inactivity */
-  if ( (GNUNET_TIME_absolute_get_duration (n->last_activity).rel_value > 
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) &&
+  if ( (GNUNET_TIME_absolute_get_duration (get_neighbour_timeout 
(n)).rel_value > 0) &&
        (GNUNET_TIME_absolute_get_duration (n->time_established).rel_value > 
GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value) )
     {
 #if DEBUG_CORE




reply via email to

[Prev in Thread] Current Thread [Next in Thread]