fix
authorChristian Grothoff <christian@grothoff.org>
Wed, 17 Feb 2010 14:39:10 +0000 (14:39 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 17 Feb 2010 14:39:10 +0000 (14:39 +0000)
src/core/gnunet-service-core.c

index b07d565f1f0d2a658c7646e56c0a35919079b6cf..f44346011255cf874f57e9f69e7b30e68d4bdd98 100644 (file)
@@ -1025,7 +1025,10 @@ free_neighbour (struct Neighbour *n)
       GNUNET_free (m);
     }
   if (NULL != n->th)
-    GNUNET_TRANSPORT_notify_transmit_ready_cancel (n->th);
+    {
+      GNUNET_TRANSPORT_notify_transmit_ready_cancel (n->th);
+      n->th = NULL;
+    }
   if (n->retry_plaintext_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (sched, n->retry_plaintext_task);
   if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK)
@@ -2029,6 +2032,24 @@ handle_client_send (void *cls,
 }
 
 
+/**
+ * Function called when the transport service is ready to
+ * receive a message.  Only resets 'n->th' to NULL.
+ *
+ * @param cls neighbour to use message from
+ * @param size number of bytes we can transmit
+ * @param buf where to copy the message
+ * @return number of bytes transmitted
+ */
+static size_t
+notify_transport_connect_done (void *cls, size_t size, void *buf)
+{
+  struct Neighbour *n = cls;
+  n->th = NULL;
+  return 0;
+}
+
+
 /**
  * Handle CORE_REQUEST_CONNECT request.
  *
@@ -2063,8 +2084,9 @@ handle_client_request_connect (void *cls,
                                                  &cm->peer,
                                                  0, 0,
                                                  GNUNET_TIME_UNIT_ZERO,
-                                                 NULL,
-                                                 NULL);
+                                                 &notify_transport_connect_done,
+                                                 n);
+  GNUNET_break (NULL != n->th);
 }