possible fix
authorChristian Grothoff <christian@grothoff.org>
Sat, 20 Nov 2010 15:28:33 +0000 (15:28 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 20 Nov 2010 15:28:33 +0000 (15:28 +0000)
src/core/core_api.c

index 802ba56d4b7cea235213bf0224cf78de298bac45..abb7fbc63d8abf139f26428e070a6a3ee1d9cc19 100644 (file)
@@ -468,8 +468,11 @@ reconnect_later (struct GNUNET_CORE_Handle *h)
     {
       GNUNET_CONTAINER_DLL_remove (h->pending_head,
                                   h->pending_tail,
-                                  cm);      
-      cm->cont (cm->cont_cls, NULL);
+                                  cm);
+      if (cm->th != NULL)
+       cm->th->cm = NULL; 
+      if (cm->cont != NULL)
+       cm->cont (cm->cont_cls, NULL);
       GNUNET_free (cm);
     }
   if (h->client != NULL)
@@ -516,22 +519,6 @@ transmission_timeout (void *cls,
                      const struct GNUNET_SCHEDULER_TaskContext *tc);
 
 
-/**
- * Control message was sent, mark it as such.
- *
- * @param cls the 'struct GNUNET_CORE_TransmitHandle*'
- * @param tc scheduler context
- */
-static void
-mark_control_message_sent (void *cls,
-                          const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  struct GNUNET_CORE_TransmitHandle *th = cls;
-
-  th->cm = NULL;
-}
-
-
 /**
  * Send a control message to the peer asking for transmission
  * of the message in the given peer record.
@@ -563,8 +550,6 @@ request_next_transmission (struct PeerRecord *pr)
                                                   pr);
   cm = GNUNET_malloc (sizeof (struct ControlMessage) + 
                      sizeof (struct SendMessageRequest));
-  cm->cont = &mark_control_message_sent;
-  cm->cont_cls = th;
   th->cm = cm;
   cm->th = th;
   smr = (struct SendMessageRequest*) &cm[1];
@@ -1415,7 +1400,8 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle)
                                   cm);
       if (cm->th != NULL)
        cm->th->cm = NULL;
-      cm->cont (cm->cont_cls, NULL);
+      if (cm->cont != NULL)
+       cm->cont (cm->cont_cls, NULL);
       GNUNET_free (cm);
     }
   GNUNET_CONTAINER_multihashmap_iterate (handle->peers,