#define DEBUG_TRANSPORT_HELLO GNUNET_NO
-#define DEBUG_ATS GNUNET_NO
+#define DEBUG_ATS GNUNET_YES
#define VERBOSE_ATS GNUNET_NO
*/
static struct GNUNET_STATISTICS_Handle *stats;
+/**
+ * Is transport service shutting down ?
+ */
+static int shutdown_in_progress;
+
/**
* Handle for ats information
*/
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)
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)
struct OwnAddressList *al;
struct CheckHelloValidatedContext *chvc;
+ shutdown_in_progress = GNUNET_YES;
while (neighbours != NULL)
{
#if DEBUG_TRANSPORT
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;
#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
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;
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
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);