gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36645 - in gnunet/src: include transport
Date: Sat, 7 Nov 2015 00:39:48 +0100

Author: grothoff
Date: 2015-11-07 00:39:48 +0100 (Sat, 07 Nov 2015)
New Revision: 36645

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:
removing definitively dead try_connect-related logic (#3675)

Modified: gnunet/src/include/gnunet_protocols.h
===================================================================
--- gnunet/src/include/gnunet_protocols.h       2015-11-06 23:28:30 UTC (rev 
36644)
+++ gnunet/src/include/gnunet_protocols.h       2015-11-06 23:39:48 UTC (rev 
36645)
@@ -1266,12 +1266,6 @@
 #define GNUNET_MESSAGE_TYPE_TRANSPORT_PONG 373
 
 /**
- * Message for transport service from a client asking that a
- * connection be initiated with another peer.
- */
-#define GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT 374
-
-/**
  * Transport SYN message exchanged between transport services to
  * indicate that a session should be marked as 'connected'.
  */

Modified: gnunet/src/include/gnunet_transport_service.h
===================================================================
--- gnunet/src/include/gnunet_transport_service.h       2015-11-06 23:28:30 UTC 
(rev 36644)
+++ gnunet/src/include/gnunet_transport_service.h       2015-11-06 23:39:48 UTC 
(rev 36645)
@@ -160,55 +160,6 @@
 GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle);
 
 
-/* ************************* Connections *********************** */
-
-/**
- * Opaque handle for a transmission-ready request.
- */
-struct GNUNET_TRANSPORT_TryConnectHandle;
-
-/**
- * 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_TryConnectCallback) (void *cls,
-                                        int result);
-
-
-/**
- * Ask the transport service to establish 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_TryConnectHandle` handle or
- *         NULL on failure (@a cb will not be called)
- * @deprecated
- */
-struct GNUNET_TRANSPORT_TryConnectHandle *
-GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle,
-                              const struct GNUNET_PeerIdentity *target,
-                              GNUNET_TRANSPORT_TryConnectCallback cb,
-                              void *cb_cls);
-
-
-/**
- * Cancel the request to transport to try a connect
- * Callback will not be called
- *
- * @param tch handle to cancel
- */
-void
-GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle 
*tch);
-
-
 /* ************************* Sending *************************** */
 
 /**

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2015-11-06 
23:28:30 UTC (rev 36644)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2015-11-06 
23:39:48 UTC (rev 36645)
@@ -876,43 +876,6 @@
 
 
 /**
- * Handle request connect message
- *
- * @param cls closure (always NULL)
- * @param client identification of the client
- * @param message the actual message
- */
-static void
-clients_handle_request_connect (void *cls,
-                                struct GNUNET_SERVER_Client *client,
-                                const struct GNUNET_MessageHeader *message)
-{
-  const struct TransportRequestConnectMessage *trcm;
-
-  trcm = (const struct TransportRequestConnectMessage *) message;
-  GNUNET_break (0 == ntohl (trcm->reserved));
-  GNUNET_STATISTICS_update (GST_stats,
-                            gettext_noop
-                            ("# REQUEST CONNECT messages received"), 1,
-                            GNUNET_NO);
-  if (0 == memcmp (&trcm->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 connect message for peer `%s'\n",
-              GNUNET_i2s (&trcm->peer));
-  GST_neighbours_try_connect (&trcm->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
@@ -1546,9 +1509,6 @@
      GNUNET_MESSAGE_TYPE_HELLO, 0},
     {&clients_handle_send, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 0},
-    {&clients_handle_request_connect, NULL,
-     GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT,
-     sizeof (struct TransportRequestConnectMessage)},
     {&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-11-06 23:28:30 UTC (rev 
36644)
+++ gnunet/src/transport/transport_api.c        2015-11-06 23:39:48 UTC (rev 
36645)
@@ -203,49 +203,6 @@
 
 
 /**
- * Entry in linked list for a try-connect request.
- */
-struct GNUNET_TRANSPORT_TryConnectHandle
-{
-  /**
-   * For the DLL.
-   */
-  struct GNUNET_TRANSPORT_TryConnectHandle *prev;
-
-  /**
-   * For the DLL.
-   */
-  struct GNUNET_TRANSPORT_TryConnectHandle *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_TryConnectCallback cb;
-
-  /**
-   * Closure for @e cb.
-   */
-  void *cb_cls;
-
-};
-
-
-/**
  * Entry in linked list for all offer-HELLO requests.
  */
 struct GNUNET_TRANSPORT_OfferHelloHandle
@@ -356,16 +313,6 @@
   struct GNUNET_TRANSPORT_GetHelloHandle *hwl_tail;
 
   /**
-   * Linked list of pending try connect requests head
-   */
-  struct GNUNET_TRANSPORT_TryConnectHandle *tc_head;
-
-  /**
-   * Linked list of pending try connect requests tail
-   */
-  struct GNUNET_TRANSPORT_TryConnectHandle *tc_tail;
-
-  /**
    * Linked list of pending offer HELLO requests head
    */
   struct GNUNET_TRANSPORT_OfferHelloHandle *oh_head;
@@ -1353,110 +1300,6 @@
 
 
 /**
- * Send #GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT message to the
- * service.
- *
- * @param cls the `struct GNUNET_TRANSPORT_TryConnectHandle`
- * @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_connect (void *cls,
-                  size_t size,
-                  void *buf)
-{
-  struct GNUNET_TRANSPORT_TryConnectHandle *tch = cls;
-  struct TransportRequestConnectMessage msg;
-
-  tch->tth = NULL;
-  if (NULL == buf)
-  {
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-         "Discarding REQUEST_CONNECT request to `%s' due to error in transport 
service connection.\n",
-         GNUNET_i2s (&tch->pid));
-    if (NULL != tch->cb)
-      tch->cb (tch->cb_cls,
-               GNUNET_SYSERR);
-    GNUNET_TRANSPORT_try_connect_cancel (tch);
-    return 0;
-  }
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Transmitting `%s' request with respect to `%s'.\n",
-       "REQUEST_CONNECT",
-       GNUNET_i2s (&tch->pid));
-  GNUNET_assert (size >= sizeof (struct TransportRequestConnectMessage));
-  msg.header.size = htons (sizeof (struct TransportRequestConnectMessage));
-  msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_CONNECT);
-  msg.reserved = htonl (0);
-  msg.peer = tch->pid;
-  memcpy (buf, &msg, sizeof (msg));
-  if (NULL != tch->cb)
-    tch->cb (tch->cb_cls, GNUNET_OK);
-  GNUNET_TRANSPORT_try_connect_cancel (tch);
-  return sizeof (struct TransportRequestConnectMessage);
-}
-
-
-/**
- * Ask the transport service to establish 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
- * @return a `struct GNUNET_TRANSPORT_TryConnectHandle` handle or
- *         NULL on failure (cb will not be called)
- */
-struct GNUNET_TRANSPORT_TryConnectHandle *
-GNUNET_TRANSPORT_try_connect (struct GNUNET_TRANSPORT_Handle *handle,
-                              const struct GNUNET_PeerIdentity *target,
-                              GNUNET_TRANSPORT_TryConnectCallback cb,
-                              void *cb_cls)
-{
-  struct GNUNET_TRANSPORT_TryConnectHandle *tch;
-
-  if (NULL == handle->client)
-    return NULL;
-  tch = GNUNET_new (struct GNUNET_TRANSPORT_TryConnectHandle);
-  tch->th = handle;
-  tch->pid = *target;
-  tch->cb = cb;
-  tch->cb_cls = cb_cls;
-  tch->tth = schedule_control_transmit (handle,
-                                        sizeof (struct 
TransportRequestConnectMessage),
-                                        &send_try_connect, tch);
-  GNUNET_CONTAINER_DLL_insert (handle->tc_head,
-                               handle->tc_tail,
-                               tch);
-  return tch;
-}
-
-
-/**
- * Cancel the request to transport to try a connect
- * Callback will not be called
- *
- * @param tch the handle to cancel
- */
-void
-GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle 
*tch)
-{
-  struct GNUNET_TRANSPORT_Handle *th;
-
-  th = tch->th;
-  if (NULL != tch->tth)
-    cancel_control_transmit (th, tch->tth);
-  GNUNET_CONTAINER_DLL_remove (th->tc_head,
-                               th->tc_tail,
-                               tch);
-  GNUNET_free (tch);
-}
-
-
-/**
  * Send HELLO message to the service.
  *
  * @param cls the HELLO message to send
@@ -1873,8 +1716,6 @@
   }
   GNUNET_free_non_null (handle->my_hello);
   handle->my_hello = NULL;
-  GNUNET_assert (NULL == handle->tc_head);
-  GNUNET_assert (NULL == handle->tc_tail);
   GNUNET_assert (NULL == handle->hwl_head);
   GNUNET_assert (NULL == handle->hwl_tail);
   GNUNET_CONTAINER_heap_destroy (handle->ready_heap);
@@ -1916,7 +1757,7 @@
   n = neighbour_find (handle, target);
   if (NULL == n)
   {
-    /* use GNUNET_TRANSPORT_try_connect first, only use this function
+    /* only use this function
      * once a connection has been established */
     GNUNET_assert (0);
     return NULL;




reply via email to

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