Improvement in reconnect: first disconnect, then destroy neighbours
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 20 Dec 2011 15:48:22 +0000 (15:48 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 20 Dec 2011 15:48:22 +0000 (15:48 +0000)
src/transport/transport_api.c

index b7704e512163b7384c07d73898db8f524a0cdfe9..9ff5cec88ff5a2bf97ed2bc883c7e22fdeb71e27 100644 (file)
@@ -933,8 +933,6 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
   struct GNUNET_TRANSPORT_TransmitHandle *th;
 
   GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK);
-  /* Forget about all neighbours that we used to be connected to */
-  GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
   if (NULL != h->cth)
   {
     GNUNET_CLIENT_notify_transmit_ready_cancel (h->cth);
@@ -945,6 +943,8 @@ disconnect_and_schedule_reconnect (struct GNUNET_TRANSPORT_Handle *h)
     GNUNET_CLIENT_disconnect (h->client, GNUNET_YES);
     h->client = NULL;
   }
+  /* Forget about all neighbours that we used to be connected to */
+  GNUNET_CONTAINER_multihashmap_iterate (h->neighbours, &neighbour_delete, h);
   if (h->quota_task != GNUNET_SCHEDULER_NO_TASK)
   {
     GNUNET_SCHEDULER_cancel (h->quota_task);