gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15392 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15392 - gnunet/src/transport
Date: Wed, 1 Jun 2011 18:08:44 +0200

Author: wachs
Date: 2011-06-01 18:08:44 +0200 (Wed, 01 Jun 2011)
New Revision: 15392

Modified:
   gnunet/src/transport/gnunet-service-transport.c
Log:
shutdown issuess


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-06-01 16:06:22 UTC 
(rev 15391)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-06-01 16:08:44 UTC 
(rev 15392)
@@ -48,7 +48,7 @@
 
 #define DEBUG_TRANSPORT_HELLO GNUNET_NO
 
-#define DEBUG_ATS GNUNET_NO
+#define DEBUG_ATS GNUNET_YES
 
 #define VERBOSE_ATS GNUNET_NO
 
@@ -1212,6 +1212,11 @@
 static struct GNUNET_STATISTICS_Handle *stats;
 
 /**
+ * Is transport service shutting down ?
+ */
+static int shutdown_in_progress;
+
+/**
  * Handle for ats information
  */
 static struct ATS_info *ats;
@@ -2729,7 +2734,8 @@
   memcpy (&cim->id, peer, sizeof (struct GNUNET_PeerIdentity));
 
   /* notify ats about connecting peer */
-  ats_notify_peer_connect (peer, &(cim->ats), 2);
+  if (shutdown_in_progress == GNUNET_NO)
+       ats_notify_peer_connect (peer, &(cim->ats), 2);
 
   cpos = clients;
   while (cpos != NULL)
@@ -2766,7 +2772,8 @@
   memcpy (&dim.peer, peer, sizeof (struct GNUNET_PeerIdentity));
 
   /* notify ats about connecting peer */
-  ats_notify_peer_disconnect (peer);
+  if (shutdown_in_progress == GNUNET_NO)
+         ats_notify_peer_disconnect (peer);
 
   cpos = clients;
   while (cpos != NULL)
@@ -6044,6 +6051,7 @@
   struct OwnAddressList *al;
   struct CheckHelloValidatedContext *chvc;
 
+  shutdown_in_progress = GNUNET_YES;
   while (neighbours != NULL)
     {
 #if DEBUG_TRANSPORT
@@ -6638,7 +6646,9 @@
                return GNUNET_SYSERR;
        }
 
+       GNUNET_assert (ats->mechanisms == NULL);
        ats->mechanisms = GNUNET_malloc((1+c_mechs) * sizeof (struct 
ATS_mechanism));
+       GNUNET_assert (ats->peers == NULL);
        ats->peers =  GNUNET_malloc((1+c_peers) * sizeof (struct ATS_peer));
 
        struct ATS_mechanism * mechanisms = ats->mechanisms;
@@ -7066,7 +7076,8 @@
 #if DEBUG_ATS
        GNUNET_log (GNUNET_ERROR_TYPE_BULK, "ATS_notify_ats_data: 
%s\n",GNUNET_i2s(peer));
 #endif
-       ats_calculate_bandwidth_distribution();
+       if (shutdown_in_progress == GNUNET_NO)
+               ats_calculate_bandwidth_distribution();
 }
 #endif //END: HAVE_LIBGLPK
 
@@ -7089,6 +7100,14 @@
                return;
        }
 
+       if (shutdown_in_progress == GNUNET_YES)
+       {
+#if DEBUG_ATS
+               GNUNET_log (GNUNET_ERROR_TYPE_BULK, "Transport service is 
shutting down\n");
+#endif
+               return;
+       }
+
        int dur = 500;
        if (INT_MAX < ats->max_exec_duration.rel_value)
                dur = INT_MAX;
@@ -7235,6 +7254,9 @@
        if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
            return;
 
+       if (shutdown_in_progress == GNUNET_YES)
+               return;
+
 #if DEBUG_ATS
        GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Running scheduled calculation\n");
 #endif
@@ -7448,6 +7470,7 @@
   unsigned long long tneigh;
   char *keyfile;
 
+  shutdown_in_progress = GNUNET_NO;
   cfg = c;
   stats = GNUNET_STATISTICS_create ("transport", cfg);
   validation_map = GNUNET_CONTAINER_multihashmap_create (64);




reply via email to

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