gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36554 - in gnunet/src: include transport


From: gnunet
Subject: [GNUnet-SVN] r36554 - in gnunet/src: include transport
Date: Sun, 18 Oct 2015 23:02:16 +0200

Author: grothoff
Date: 2015-10-18 23:02:16 +0200 (Sun, 18 Oct 2015)
New Revision: 36554

Modified:
   gnunet/src/include/gnunet_protocols.h
   gnunet/src/include/gnunet_transport_service.h
   gnunet/src/transport/gnunet-service-transport_clients.c
   gnunet/src/transport/transport_api.c
Log:
-remove deprecated try_disconnect API

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2015-10-18 20:58:31 UTC (rev 
36553)
+++ gnunet/src/include/gnunet_protocols.h       2015-10-18 21:02:16 UTC (rev 
36554)
@@ -1364,13 +1364,7 @@
  */
 #define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PLUGIN_SYNC 390
 
-/**
- * Message for transport service from a client asking that a
- * connection with another peer be torn down.
- */
-#define GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT 391
 
-
 
/*******************************************************************************
  * FS-PUBLISH-HELPER IPC Messages
  
******************************************************************************/

Modified: gnunet/src/include/gnunet_transport_service.h
===================================================================
--- gnunet/src/include/gnunet_transport_service.h       2015-10-18 20:58:31 UTC 
(rev 36553)
+++ gnunet/src/include/gnunet_transport_service.h       2015-10-18 21:02:16 UTC 
(rev 36554)
@@ -209,52 +209,6 @@
 GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle 
*tch);
 
 
-/**
- * Opaque handle for a transmission-ready request.
- */
-struct GNUNET_TRANSPORT_TryDisconnectHandle;
-
-/**
- * Function to call with result of the try connect request.
- *
- * @param cls closure
- * @param result #GNUNET_OK if message was transmitted to transport service
- *               #GNUNET_SYSERR if message was not transmitted to transport 
service
- */
-typedef void
-(*GNUNET_TRANSPORT_TryDisconnectCallback) (void *cls,
-                                           int result);
-
-
-/**
- * Ask the transport service to disconnect from the given peer.
- *
- * @param handle connection to transport service
- * @param target who we should try to disconnect from
- * @param cb callback to be called when request was transmitted to transport
- *         service
- * @param cb_cls closure for the callback @a cb
- * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or
- *         NULL on failure (@a cb will not be called)
- * @deprecated use blacklisting API instead!
- */
-struct GNUNET_TRANSPORT_TryDisconnectHandle *
-GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle,
-                                 const struct GNUNET_PeerIdentity *target,
-                                 GNUNET_TRANSPORT_TryDisconnectCallback cb,
-                                 void *cb_cls);
-
-
-/**
- * Cancel the request to transport to disconnect.
- * Callback will not be called anymore.
- *
- * @param tdh handle for operation to cancel
- */
-void
-GNUNET_TRANSPORT_try_disconnect_cancel (struct 
GNUNET_TRANSPORT_TryDisconnectHandle *tdh);
-
-
 /* ************************* Sending *************************** */
 
 /**

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2015-10-18 
20:58:31 UTC (rev 36553)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2015-10-18 
21:02:16 UTC (rev 36554)
@@ -879,42 +879,6 @@
 
 
 /**
- * Handle request disconnect message
- *
- * @param cls closure (always NULL)
- * @param client identification of the client
- * @param message the actual message
- */
-static void
-clients_handle_request_disconnect (void *cls,
-                                   struct GNUNET_SERVER_Client *client,
-                                   const struct GNUNET_MessageHeader *message)
-{
-  const struct TransportRequestDisconnectMessage *trdm;
-
-  trdm = (const struct TransportRequestDisconnectMessage *) message;
-  GNUNET_break (0 == ntohl (trdm->reserved));
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                            ("# REQUEST DISCONNECT messages received"), 1,
-                            GNUNET_NO);
-  if (0 == memcmp (&trdm->peer,
-                   &GST_my_identity,
-                   sizeof (struct GNUNET_PeerIdentity)))
-  {
-    GNUNET_break (0);
-    GNUNET_SERVER_receive_done (client, GNUNET_OK);
-    return;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Received a request disconnect message for peer `%s'\n",
-              GNUNET_i2s (&trdm->peer));
-  (void) GST_neighbours_force_disconnect (&trdm->peer);
-  GNUNET_SERVER_receive_done (client, GNUNET_OK);
-}
-
-
-/**
  * Take the given address and append it to the set of results sent back to
  * the client.  This function may be called serveral times for a single
  * conversion.   The last invocation will be with a @a address of
@@ -1551,9 +1515,6 @@
     {&clients_handle_request_connect, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT,
      sizeof (struct TransportRequestConnectMessage)},
-    {&clients_handle_request_disconnect, NULL,
-     GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT,
-     sizeof (struct TransportRequestDisconnectMessage)},
     {&clients_handle_address_to_string, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0},
     {&clients_handle_monitor_peers, NULL,

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2015-10-18 20:58:31 UTC (rev 
36553)
+++ gnunet/src/transport/transport_api.c        2015-10-18 21:02:16 UTC (rev 
36554)
@@ -246,49 +246,6 @@
 
 
 /**
- * Entry in linked list for all try-disconnect requests
- */
-struct GNUNET_TRANSPORT_TryDisconnectHandle
-{
-  /**
-   * For the DLL.
-   */
-  struct GNUNET_TRANSPORT_TryDisconnectHandle *prev;
-
-  /**
-   * For the DLL.
-   */
-  struct GNUNET_TRANSPORT_TryDisconnectHandle *next;
-
-  /**
-   * Peer we should try to connect to.
-   */
-  struct GNUNET_PeerIdentity pid;
-
-  /**
-   * Transport service handle this request is part of.
-   */
-  struct GNUNET_TRANSPORT_Handle *th;
-
-  /**
-   * Message transmission request to communicate to service.
-   */
-  struct GNUNET_TRANSPORT_TransmitHandle *tth;
-
-  /**
-   * Function to call upon completion (of request transmission).
-   */
-  GNUNET_TRANSPORT_TryDisconnectCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-};
-
-
-/**
  * Entry in linked list for all offer-HELLO requests.
  */
 struct GNUNET_TRANSPORT_OfferHelloHandle
@@ -409,16 +366,6 @@
   struct GNUNET_TRANSPORT_TryConnectHandle *tc_tail;
 
   /**
-   * Linked list of pending try disconnect requests head
-   */
-  struct GNUNET_TRANSPORT_TryDisconnectHandle *td_head;
-
-  /**
-   * Linked list of pending try connect requests tail
-   */
-  struct GNUNET_TRANSPORT_TryDisconnectHandle *td_tail;
-
-  /**
    * Linked list of pending offer HELLO requests head
    */
   struct GNUNET_TRANSPORT_OfferHelloHandle *oh_head;
@@ -1501,111 +1448,6 @@
 
 
 /**
- * Send #GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT message to the
- * service.
- *
- * @param cls the `struct GNUNET_TRANSPORT_TryDisconnectHandle`
- * @param size number of bytes available in @a buf
- * @param buf where to copy the message
- * @return number of bytes copied to @a buf
- */
-static size_t
-send_try_disconnect (void *cls,
-                     size_t size,
-                     void *buf)
-{
-  struct GNUNET_TRANSPORT_TryDisconnectHandle *tdh = cls;
-  struct TransportRequestConnectMessage msg;
-
-  tdh->th = NULL;
-  if (NULL == buf)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Discarding  `%s' request to `%s' due to error in transport service 
connection.\n",
-         "REQUEST_DISCONNECT",
-         GNUNET_i2s (&tdh->pid));
-    if (NULL != tdh->cb)
-      tdh->cb (tdh->cb_cls,
-               GNUNET_SYSERR);
-    GNUNET_TRANSPORT_try_disconnect_cancel (tdh);
-    return 0;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transmitting `%s' request with respect to `%s'.\n",
-       "REQUEST_DISCONNECT",
-       GNUNET_i2s (&tdh->pid));
-  GNUNET_assert (size >= sizeof (struct TransportRequestDisconnectMessage));
-  msg.header.size = htons (sizeof (struct TransportRequestDisconnectMessage));
-  msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_DISCONNECT);
-  msg.reserved = htonl (0);
-  msg.peer = tdh->pid;
-  memcpy (buf, &msg, sizeof (msg));
-  if (NULL != tdh->cb)
-    tdh->cb (tdh->cb_cls, GNUNET_OK);
-  GNUNET_TRANSPORT_try_disconnect_cancel (tdh);
-  return sizeof (struct TransportRequestDisconnectMessage);
-}
-
-
-/**
- * Ask the transport service to shutdown a connection to
- * the given peer.
- *
- * @param handle connection to transport service
- * @param target who we should try to connect to
- * @param cb callback to be called when request was transmitted to transport
- *         service
- * @param cb_cls closure for the callback @a cb
- * @return a `struct GNUNET_TRANSPORT_TryDisconnectHandle` handle or
- *         NULL on failure (cb will not be called)
- */
-struct GNUNET_TRANSPORT_TryDisconnectHandle *
-GNUNET_TRANSPORT_try_disconnect (struct GNUNET_TRANSPORT_Handle *handle,
-                                 const struct GNUNET_PeerIdentity *target,
-                                 GNUNET_TRANSPORT_TryDisconnectCallback cb,
-                                 void *cb_cls)
-{
-  struct GNUNET_TRANSPORT_TryDisconnectHandle *tdh;
-
-  if (NULL == handle->client)
-    return NULL;
-  tdh = GNUNET_new (struct GNUNET_TRANSPORT_TryDisconnectHandle);
-  tdh->th = handle;
-  tdh->pid = *target;
-  tdh->cb = cb;
-  tdh->cb_cls = cb_cls;
-  tdh->tth = schedule_control_transmit (handle,
-                                        sizeof (struct 
TransportRequestDisconnectMessage),
-                                        &send_try_disconnect, tdh);
-  GNUNET_CONTAINER_DLL_insert (handle->td_head,
-                               handle->td_tail,
-                               tdh);
-  return tdh;
-}
-
-
-/**
- * Cancel the request to transport to try a disconnect
- * Callback will not be called
- *
- * @param tdh the handle to cancel
- */
-void
-GNUNET_TRANSPORT_try_disconnect_cancel (struct 
GNUNET_TRANSPORT_TryDisconnectHandle *tdh)
-{
-  struct GNUNET_TRANSPORT_Handle *th;
-
-  th = tdh->th;
-  if (NULL != tdh->tth)
-    cancel_control_transmit (th, tdh->tth);
-  GNUNET_CONTAINER_DLL_remove (th->td_head,
-                               th->td_tail,
-                               tdh);
-  GNUNET_free (tdh);
-}
-
-
-/**
  * Send HELLO message to the service.
  *
  * @param cls the HELLO message to send




reply via email to

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