[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r17214 - in gnunet/src: core include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r17214 - in gnunet/src: core include |
Date: |
Wed, 5 Oct 2011 15:34:00 +0200 |
Author: grothoff
Date: 2011-10-05 15:33:59 +0200 (Wed, 05 Oct 2011)
New Revision: 17214
Modified:
gnunet/src/core/core_api.c
gnunet/src/core/test_core_api.c
gnunet/src/core/test_core_api_preferences.c
gnunet/src/core/test_core_api_reliability.c
gnunet/src/core/test_core_quota_compliance.c
gnunet/src/include/gnunet_core_service.h
Log:
eliminate last calls to GNUNET_CORE_peer_request_connect
Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c 2011-10-05 13:26:24 UTC (rev 17213)
+++ gnunet/src/core/core_api.c 2011-10-05 13:33:59 UTC (rev 17214)
@@ -121,6 +121,19 @@
/**
+ * Type of function called upon completion.
+ *
+ * @param cls closure
+ * @param success GNUNET_OK on success (which for request_connect
+ * ONLY means that we transmitted the connect request to CORE,
+ * it does not mean that we are actually now connected!);
+ * GNUNET_NO on timeout,
+ * GNUNET_SYSERR if core was shut down
+ */
+typedef void (*GNUNET_CORE_ControlContinuation) (void *cls, int success);
+
+
+/**
* Entry in a doubly-linked list of control messages to be transmitted
* to the core service. Control messages include traffic allocation,
* connection requests and of course our initial 'init' request.
@@ -1623,143 +1636,6 @@
}
-/* ****************** GNUNET_CORE_peer_request_connect ******************** */
-
-/**
- * Handle for a request to the core to connect to
- * a particular peer. Can be used to cancel the request
- * (before the 'cont'inuation is called).
- */
-struct GNUNET_CORE_PeerRequestHandle
-{
-
- /**
- * Link to control message.
- */
- struct ControlMessage *cm;
-
- /**
- * Core handle used.
- */
- struct GNUNET_CORE_Handle *h;
-
- /**
- * Continuation to run when done.
- */
- GNUNET_CORE_ControlContinuation cont;
-
- /**
- * Closure for 'cont'.
- */
- void *cont_cls;
-
-};
-
-
-/**
- * Continuation called when the control message was transmitted.
- * Calls the original continuation and frees the remaining
- * resources.
- *
- * @param cls the 'struct GNUNET_CORE_PeerRequestHandle'
- * @param success was the request transmitted?
- */
-static void
-peer_request_connect_cont (void *cls, int success)
-{
- struct GNUNET_CORE_PeerRequestHandle *ret = cls;
-
- if (ret->cont != NULL)
- ret->cont (ret->cont_cls, success);
- GNUNET_free (ret);
-}
-
-
-/**
- * Request that the core should try to connect to a particular peer.
- * Once the request has been transmitted to the core, the continuation
- * function will be called. Note that this does NOT mean that a
- * connection was successfully established -- it only means that the
- * core will now try. Successful establishment of the connection
- * will be signalled to the 'connects' callback argument of
- * 'GNUNET_CORE_connect' only. If the core service does not respond
- * to our connection attempt within the given time frame, 'cont' will
- * be called with the TIMEOUT reason code.
- *
- * @param h core handle
- * @param peer who should we connect to
- * @param cont function to call once the request has been completed (or timed
out)
- * @param cont_cls closure for cont
- *
- * @return NULL on error or already connected,
- * otherwise handle for cancellation
- */
-struct GNUNET_CORE_PeerRequestHandle *
-GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h,
- const struct GNUNET_PeerIdentity *peer,
- GNUNET_CORE_ControlContinuation cont,
- void *cont_cls)
-{
- struct GNUNET_CORE_PeerRequestHandle *ret;
- struct ControlMessage *cm;
- struct ConnectMessage *msg;
-
- if (NULL != GNUNET_CONTAINER_multihashmap_get (h->peers, &peer->hashPubKey))
- {
-#if DEBUG_CORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peers are already connected!\n");
-#endif
- return NULL;
- }
-
- cm = GNUNET_malloc (sizeof (struct ControlMessage) +
- sizeof (struct ConnectMessage));
- msg = (struct ConnectMessage *) &cm[1];
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT);
- msg->header.size = htons (sizeof (struct ConnectMessage));
- msg->reserved = htonl (0);
- msg->peer = *peer;
- GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head,
- h->control_pending_tail, cm);
- ret = GNUNET_malloc (sizeof (struct GNUNET_CORE_PeerRequestHandle));
- ret->h = h;
- ret->cm = cm;
- ret->cont = cont;
- ret->cont_cls = cont_cls;
- cm->cont = &peer_request_connect_cont;
- cm->cont_cls = ret;
-#if DEBUG_CORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queueing REQUEST_CONNECT request\n");
-#endif
- trigger_next_request (h, GNUNET_NO);
- return ret;
-}
-
-
-/**
- * Cancel a pending request to connect to a particular peer. Must not
- * be called after the 'cont' function was invoked.
- *
- * @param req request handle that was returned for the original request
- */
-void
-GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle
- *req)
-{
- struct GNUNET_CORE_Handle *h = req->h;
- struct ControlMessage *cm = req->cm;
-
-#if DEBUG_CORE
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "A CHANGE PREFERENCE request was cancelled!\n");
-#endif
- GNUNET_CONTAINER_DLL_remove (h->control_pending_head,
h->control_pending_tail,
- cm);
- GNUNET_free (cm);
- GNUNET_free (req);
-}
-
-
/* ****************** GNUNET_CORE_peer_change_preference ********************
*/
Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c 2011-10-05 13:26:24 UTC (rev 17213)
+++ gnunet/src/core/test_core_api.c 2011-10-05 13:33:59 UTC (rev 17214)
@@ -261,7 +261,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking core (1) to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
- GNUNET_CORE_peer_request_connect (p1.ch, &p2.id, NULL, NULL);
+ GNUNET_TRANSPORT_try_connect (p1.th, &p2.id);
}
static void
Modified: gnunet/src/core/test_core_api_preferences.c
===================================================================
--- gnunet/src/core/test_core_api_preferences.c 2011-10-05 13:26:24 UTC (rev
17213)
+++ gnunet/src/core/test_core_api_preferences.c 2011-10-05 13:33:59 UTC (rev
17214)
@@ -340,7 +340,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Asking core (1) AGAIN to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
- GNUNET_CORE_peer_request_connect (p1.ch, &p2.id, NULL, NULL);
+ GNUNET_TRANSPORT_try_connect (p1.th, &p2.id);
}
Modified: gnunet/src/core/test_core_api_reliability.c
===================================================================
--- gnunet/src/core/test_core_api_reliability.c 2011-10-05 13:26:24 UTC (rev
17213)
+++ gnunet/src/core/test_core_api_reliability.c 2011-10-05 13:33:59 UTC (rev
17214)
@@ -391,9 +391,9 @@
OKPP;
GNUNET_assert (cls == &p2);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Asking core (1) to connect to peer `%4s'\n",
+ "Asking transport (1) to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
- GNUNET_CORE_peer_request_connect (p1.ch, &p2.id, NULL, NULL);
+ GNUNET_TRANSPORT_try_connect (p1.th, &p2.id);
}
}
Modified: gnunet/src/core/test_core_quota_compliance.c
===================================================================
--- gnunet/src/core/test_core_quota_compliance.c 2011-10-05 13:26:24 UTC
(rev 17213)
+++ gnunet/src/core/test_core_quota_compliance.c 2011-10-05 13:33:59 UTC
(rev 17214)
@@ -534,7 +534,7 @@
"Asking core (1) to connect to peer `%4s'\n",
GNUNET_i2s (&p2.id));
#endif
- GNUNET_CORE_peer_request_connect (p1.ch, &p2.id, NULL, NULL);
+ GNUNET_TRANSPORT_try_connect (p1.ch, &p2.id);
}
}
Modified: gnunet/src/include/gnunet_core_service.h
===================================================================
--- gnunet/src/include/gnunet_core_service.h 2011-10-05 13:26:24 UTC (rev
17213)
+++ gnunet/src/include/gnunet_core_service.h 2011-10-05 13:33:59 UTC (rev
17214)
@@ -245,62 +245,6 @@
/**
- * Handle for a request to the core to connect or disconnect
- * from a particular peer. Can be used to cancel the request
- * (before the 'cont'inuation is called).
- */
-struct GNUNET_CORE_PeerRequestHandle;
-
-
-/**
- * Type of function called upon completion.
- *
- * @param cls closure
- * @param success GNUNET_OK on success (which for request_connect
- * ONLY means that we transmitted the connect request to CORE,
- * it does not mean that we are actually now connected!);
- * GNUNET_NO on timeout,
- * GNUNET_SYSERR if core was shut down
- */
-typedef void (*GNUNET_CORE_ControlContinuation) (void *cls, int success);
-
-
-/**
- * Request that the core should try to connect to a particular peer.
- * Once the request has been transmitted to the core, the continuation
- * function will be called. Note that this does NOT mean that a
- * connection was successfully established -- it only means that the
- * core will now try. Successful establishment of the connection
- * will be signalled to the 'connects' callback argument of
- * 'GNUNET_CORE_connect' only. If the core service does not respond
- * to our connection attempt within the given time frame, 'cont' will
- * be called with the TIMEOUT reason code.
- *
- * @param h core handle
- * @param peer who should we connect to
- * @param cont function to call once the request has been completed (or timed
out)
- * @param cont_cls closure for cont
- * @return NULL on error (cont will not be called), otherwise handle for
cancellation
- */
-struct GNUNET_CORE_PeerRequestHandle *
-GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h,
- const struct GNUNET_PeerIdentity *peer,
- GNUNET_CORE_ControlContinuation cont,
- void *cont_cls);
-
-
-/**
- * Cancel a pending request to connect to a particular peer. Must not
- * be called after the 'cont' function was invoked.
- *
- * @param req request handle that was returned for the original request
- */
-void
-GNUNET_CORE_peer_request_connect_cancel (struct GNUNET_CORE_PeerRequestHandle
- *req);
-
-
-/**
* Function called with perference change information about the given peer.
*
* @param cls closure
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r17214 - in gnunet/src: core include,
gnunet <=