fix
authorSree Harsha Totakura <totakura@in.tum.de>
Fri, 19 Oct 2012 14:19:55 +0000 (14:19 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Fri, 19 Oct 2012 14:19:55 +0000 (14:19 +0000)
src/testbed/gnunet-service-testbed.c

index 895ab34ca74ee57f902e3386af5c76d38385049c..0f75f028d94a0c928adef884665e2eedbde1b0a2 100644 (file)
@@ -2666,13 +2666,14 @@ cleanup_occ (struct OverlayConnectContext *occ)
   {
     GNUNET_TRANSPORT_disconnect (occ->p2th);
     peer_list[occ->other_peer_id]->reference_cnt--;
-    if ((GNUNET_YES == peer_list[occ->other_peer_id]->destroy_flag)
-        && (0 == peer_list[occ->other_peer_id]->reference_cnt))
-      destroy_peer (peer_list[occ->other_peer_id]);
   }
   if ((GNUNET_YES == occ->peer->destroy_flag)
       && (0 == occ->peer->reference_cnt))
     destroy_peer (occ->peer);
+  if ((NULL == occ->peer2_controller)
+      && (GNUNET_YES == peer_list[occ->other_peer_id]->destroy_flag)
+        && (0 == peer_list[occ->other_peer_id]->reference_cnt))
+      destroy_peer (peer_list[occ->other_peer_id]);  
   GNUNET_CONTAINER_DLL_remove (occq_head, occq_tail, occ);
   GNUNET_free (occ);
 }