- allow for destruction of channel inside inbound handler
authorBart Polot <bart@net.in.tum.de>
Tue, 26 Nov 2013 15:51:16 +0000 (15:51 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 26 Nov 2013 15:51:16 +0000 (15:51 +0000)
src/mesh/mesh_api.c

index 943b006ade0598dba6f4a32e9ee76767443df215..36d25b4e2a9d5ca677e88f3de233d90a6a414c1b 100644 (file)
@@ -771,6 +771,8 @@ process_channel_created (struct GNUNET_MESH_Handle *h,
   }
   if (NULL != h->new_channel)
   {
+    void *ctx;
+
     ch = create_channel (h, chid);
     ch->allow_send = GNUNET_NO;
     ch->peer = GNUNET_PEER_intern (&msg->peer);
@@ -794,7 +796,9 @@ process_channel_created (struct GNUNET_MESH_Handle *h,
       ch->ooorder = GNUNET_NO;
 
     LOG (GNUNET_ERROR_TYPE_DEBUG, "  created channel %p\n", ch);
-    ch->ctx = h->new_channel (h->cls, ch, &msg->peer, ch->port);
+    ctx = h->new_channel (h->cls, ch, &msg->peer, ch->port);
+    if (NULL != ctx)
+      ch->ctx = ctx;
     LOG (GNUNET_ERROR_TYPE_DEBUG, "User notified\n");
   }
   else