gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13707 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r13707 - gnunet/src/core
Date: Tue, 16 Nov 2010 21:48:40 +0100

Author: grothoff
Date: 2010-11-16 21:48:40 +0100 (Tue, 16 Nov 2010)
New Revision: 13707

Modified:
   gnunet/src/core/core_api.c
Log:
fix cont mess

Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c  2010-11-16 20:23:34 UTC (rev 13706)
+++ gnunet/src/core/core_api.c  2010-11-16 20:48:40 UTC (rev 13707)
@@ -143,6 +143,10 @@
    */
   void *cont_cls;
 
+  /**
+   * Transmit handle (if one is associated with this ControlMessage), or NULL.
+   */
+  struct GNUNET_CORE_TransmitHandle *th;
 };
 
 
@@ -561,6 +565,7 @@
   cm->cont = &mark_control_message_sent;
   cm->cont_cls = th;
   th->cm = cm;
+  cm->th = th;
   smr = (struct SendMessageRequest*) &cm[1];
   smr->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST);
   smr->header.size = htons (sizeof (struct SendMessageRequest));
@@ -659,8 +664,12 @@
       GNUNET_CONTAINER_DLL_remove (h->pending_head,
                                   h->pending_tail,
                                   cm);     
+      if (cm->th != NULL)
+       cm->th->cm = NULL;
       if (NULL != cm->cont)
-       cm->cont (cm->cont_cls, NULL);
+       GNUNET_SCHEDULER_add_continuation (cm->cont, 
+                                          cm->cont_cls,
+                                          GNUNET_SCHEDULER_REASON_PREREQ_DONE);
       GNUNET_free (cm);
       trigger_next_request (h, GNUNET_NO);
       return msize;
@@ -1403,6 +1412,8 @@
       GNUNET_CONTAINER_DLL_remove (handle->pending_head,
                                   handle->pending_tail,
                                   cm);
+      if (cm->th != NULL)
+       cm->th->cm = NULL;
       cm->cont (cm->cont_cls, NULL);
       GNUNET_free (cm);
     }
@@ -1885,71 +1896,4 @@
 }
 
 
-#if NEW
-/* ********************* GNUNET_CORE_iterate_peers *********************** */
-
-/**
- * Context for 'iterate_peers' helper function.
- */
-struct IterationContext
-{
-  /**
-   * Callback to call.
-   */
-  GNUNET_CORE_ConnectEventHandler peer_cb;
-
-  /**
-   * Closure for 'peer_cb'.
-   */
-  void *cb_cls;
-};
-
-
-/**
- * Call callback for each peer.
- *
- * @param cls the 'struct IterationContext'
- * @param hc peer identity, not used
- * @param value the 'struct PeerRecord'
- * @return GNUNET_YES (continue iteration)
- */
-static int
-iterate_peers (void *cls,
-              const GNUNET_HashCode *hc,
-              void *value)
-{
-  struct IterationContext *ic = cls;
-  struct PeerRecord *pr = value;
-
-  ic->peer_cb (ic->cb_cls,
-              &pr->peer,
-              NULL /* FIXME: pass atsi? */);
-  return GNUNET_YES;
-}
-
-
-/**
- * Obtain statistics and/or change preferences for the given peer.
- *
- * @param h handle to core
- * @param peer_cb function to call with the peer information
- * @param cb_cls closure for peer_cb
- * @return GNUNET_OK if iterating, GNUNET_SYSERR on error
- */
-int
-GNUNET_CORE_iterate_peers (struct GNUNET_CORE_Handle *h,
-                           GNUNET_CORE_ConnectEventHandler peer_cb,
-                           void *cb_cls)
-{
-  struct IterationContext ic;
-
-  ic.peer_cb = peer_cb;
-  ic.cb_cls = cb_cls;
-  GNUNET_CONTAINER_multihashmap_iterate (h->peers,
-                                        &iterate_peers,
-                                        &ic);
-  return GNUNET_OK;
-}
-#endif
-
 /* end of core_api.c */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]