gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15428 - in gnunet/src: core dht include mesh testing topol


From: gnunet
Subject: [GNUnet-SVN] r15428 - in gnunet/src: core dht include mesh testing topology
Date: Sun, 5 Jun 2011 15:26:22 +0200

Author: grothoff
Date: 2011-06-05 15:26:22 +0200 (Sun, 05 Jun 2011)
New Revision: 15428

Modified:
   gnunet/src/core/Makefile.am
   gnunet/src/core/core.h
   gnunet/src/core/core_api.c
   gnunet/src/core/gnunet-service-core.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/dht/gnunet-service-dht.c
   gnunet/src/include/gnunet_core_service.h
   gnunet/src/mesh/mesh_api.c
   gnunet/src/testing/testing.c
   gnunet/src/testing/testing_group.c
   gnunet/src/topology/gnunet-daemon-topology.c
Log:
use new transport API, minor core API change

Modified: gnunet/src/core/Makefile.am
===================================================================
--- gnunet/src/core/Makefile.am 2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/core/Makefile.am 2011-06-05 13:26:22 UTC (rev 15428)
@@ -33,7 +33,7 @@
   $(top_builddir)/src/hello/libgnunethello.la \
   $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
-  $(top_builddir)/src/transport/libgnunettransport.la \
+  $(top_builddir)/src/transport/libgnunettransportnew.la \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(GN_LIBINTL)
 

Modified: gnunet/src/core/core.h
===================================================================
--- gnunet/src/core/core.h      2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/core/core.h      2011-06-05 13:26:22 UTC (rev 15428)
@@ -471,11 +471,6 @@
   uint32_t reserved GNUNET_PACKED;
 
   /**
-   * When to time out.
-   */
-  struct GNUNET_TIME_RelativeNBO timeout;
-
-  /**
    * Identity of the other peer.
    */
   struct GNUNET_PeerIdentity peer;

Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c  2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/core/core_api.c  2011-06-05 13:26:22 UTC (rev 15428)
@@ -1783,7 +1783,6 @@
  * be called with the TIMEOUT reason code.
  *
  * @param h core handle
- * @param timeout how long to try to talk to core
  * @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
@@ -1793,7 +1792,6 @@
  */
 struct GNUNET_CORE_PeerRequestHandle *
 GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h,
-                                 struct GNUNET_TIME_Relative timeout,
                                  const struct GNUNET_PeerIdentity * peer,
                                  GNUNET_CORE_ControlContinuation cont,
                                  void *cont_cls)
@@ -1803,7 +1801,7 @@
   struct ConnectMessage *msg;
 
   if (NULL != GNUNET_CONTAINER_multihashmap_get (h->peers,
-                                          &peer->hashPubKey))
+                                                &peer->hashPubKey))
     {
 #if DEBUG_CORE
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 
@@ -1818,7 +1816,6 @@
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT);
   msg->header.size = htons (sizeof (struct ConnectMessage));
   msg->reserved = htonl (0);
-  msg->timeout = GNUNET_TIME_relative_hton (timeout);
   msg->peer = *peer;
   GNUNET_CONTAINER_DLL_insert_tail (h->control_pending_head,
                                    h->control_pending_tail,

Modified: gnunet/src/core/gnunet-service-core.c
===================================================================
--- gnunet/src/core/gnunet-service-core.c       2011-06-05 13:25:21 UTC (rev 
15427)
+++ gnunet/src/core/gnunet-service-core.c       2011-06-05 13:26:22 UTC (rev 
15428)
@@ -2937,59 +2937,6 @@
 
 
 /**
- * Function called when the transport service is ready to
- * receive a message.  Only resets 'n->th' to NULL.
- *
- * @param cls neighbour to use message from
- * @param size number of bytes we can transmit
- * @param buf where to copy the message
- * @return number of bytes transmitted
- */
-static size_t
-notify_transport_connect_done (void *cls,
-                              size_t size,
-                              void *buf)
-{
-  struct Neighbour *n = cls;
-
-  n->th = NULL;
-  if (GNUNET_YES != n->is_connected)
-    {
-      /* transport should only call us to transmit a message after
-       * telling us about a successful connection to the respective peer */
-#if DEBUG_CORE
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
-                 "Timeout on notify connect!\n");
-#endif
-      GNUNET_STATISTICS_update (stats, 
-                               gettext_noop ("# connection requests timed out 
in transport"), 
-                               1,
-                               GNUNET_NO);
-      return 0;
-    }
-  if (buf == NULL)
-    {
-      GNUNET_STATISTICS_update (stats,
-                                gettext_noop ("# connection requests timed out 
in transport"),
-                                1,
-                                GNUNET_NO);
-      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                 _("Failed to connect to `%4s': transport failed to 
connect\n"),
-                 GNUNET_i2s (&n->peer));
-      return 0;
-    }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-             _("TRANSPORT connection to peer `%4s' is up, trying to establish 
CORE connection\n"),
-             GNUNET_i2s (&n->peer));
-  if (n->retry_set_key_task != GNUNET_SCHEDULER_NO_TASK)
-    GNUNET_SCHEDULER_cancel (n->retry_set_key_task);
-  n->retry_set_key_task = GNUNET_SCHEDULER_add_now (&set_key_retry_task,
-                                                   n);
-  return 0;
-}
-
-
-/**
  * Handle CORE_REQUEST_CONNECT request.
  *
  * @param cls unused
@@ -3003,7 +2950,6 @@
 {
   const struct ConnectMessage *cm = (const struct ConnectMessage*) message;
   struct Neighbour *n;
-  struct GNUNET_TIME_Relative timeout;
 
   if (0 == memcmp (&cm->peer, 
                   &my_identity, 
@@ -3012,64 +2958,33 @@
       /* In this case a client has asked us to connect to ourselves, not 
really an error! */
       GNUNET_SERVER_receive_done (client, GNUNET_OK);
       return;
-    }
-  timeout = GNUNET_TIME_relative_ntoh (cm->timeout);
+    }  
   GNUNET_break (ntohl (cm->reserved) == 0);
-  GNUNET_SERVER_receive_done (client, GNUNET_OK);
-  n = find_neighbour (&cm->peer);
-  if (n == NULL)
-    n = create_neighbour (&cm->peer);
-  if ( (GNUNET_YES == n->is_connected) ||
-       (n->th != NULL) )
-    {
-      if (GNUNET_YES == n->is_connected) 
-       {
-         GNUNET_STATISTICS_update (stats, 
-                                   gettext_noop ("# connection requests 
ignored (already connected)"), 
-                                   1,
-                                   GNUNET_NO);
-       }
-      else
-        {
-         if (NULL != n->th)
-           {
-             GNUNET_TRANSPORT_notify_transmit_ready_cancel (n->th);
-             n->th = NULL;
-           }
-          n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport,
-                                                          &cm->peer,
-                                                          sizeof (struct 
GNUNET_MessageHeader), 0,
-                                                          timeout,
-                                                          
&notify_transport_connect_done,
-                                                          n);
-          GNUNET_break (NULL != n->th);
-          GNUNET_STATISTICS_update (stats,
-                                    gettext_noop ("# connection requests 
retried (due to repeat request connect)"),
-                                    1,
-                                    GNUNET_NO);
-        }
-      return; /* already connected, or at least trying */
-    }
-  GNUNET_STATISTICS_update (stats, 
-                           gettext_noop ("# connection requests received"), 
-                           1,
-                           GNUNET_NO);
-
 #if DEBUG_CORE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Core received `%s' request for `%4s', will try to establish 
connection\n",
              "REQUEST_CONNECT",
              GNUNET_i2s (&cm->peer));
 #endif
-
-  /* ask transport to connect to the peer */
-  n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport,
-                                                 &cm->peer,
-                                                 sizeof (struct 
GNUNET_MessageHeader), 0,
-                                                 timeout,
-                                                 
&notify_transport_connect_done,
-                                                 n);
-  GNUNET_break (NULL != n->th);
+  GNUNET_STATISTICS_update (stats, 
+                           gettext_noop ("# connection requests received"), 
+                           1,
+                           GNUNET_NO);
+  GNUNET_SERVER_receive_done (client, GNUNET_OK);
+  n = find_neighbour (&cm->peer);
+  if ( (n == NULL) || 
+       (GNUNET_YES != n->is_connected) )
+    {
+      GNUNET_TRANSPORT_try_connect (transport,
+                                   &cm->peer);
+    }
+  else
+    {
+      GNUNET_STATISTICS_update (stats, 
+                               gettext_noop ("# connection requests ignored 
(already connected)"), 
+                               1,
+                               GNUNET_NO);
+    }
 }
 
 

Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c     2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/core/test_core_api.c     2011-06-05 13:26:22 UTC (rev 15428)
@@ -255,7 +255,6 @@
                   "Asking core (1) to connect to peer `%4s'\n",
                   GNUNET_i2s (&p2.id));
       GNUNET_CORE_peer_request_connect (p1.ch,
-                                       GNUNET_TIME_UNIT_SECONDS,
                                        &p2.id,
                                        NULL, NULL);
     }

Modified: gnunet/src/core/test_core_api_preferences.c
===================================================================
--- gnunet/src/core/test_core_api_preferences.c 2011-06-05 13:25:21 UTC (rev 
15427)
+++ gnunet/src/core/test_core_api_preferences.c 2011-06-05 13:26:22 UTC (rev 
15428)
@@ -321,7 +321,6 @@
              "Asking core (1) AGAIN to connect to peer `%4s'\n",
              GNUNET_i2s (&p2.id));
   GNUNET_CORE_peer_request_connect (p1.ch,
-                                   GNUNET_TIME_UNIT_SECONDS,
                                    &p2.id,
                                    NULL, NULL);
 }
@@ -371,7 +370,6 @@
        GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
                                      &ask_connect_task, NULL);
       GNUNET_CORE_peer_request_connect (p1.ch,
-                                       GNUNET_TIME_UNIT_SECONDS,
                                        &p2.id,
                                        NULL, NULL);
     }

Modified: gnunet/src/core/test_core_api_reliability.c
===================================================================
--- gnunet/src/core/test_core_api_reliability.c 2011-06-05 13:25:21 UTC (rev 
15427)
+++ gnunet/src/core/test_core_api_reliability.c 2011-06-05 13:26:22 UTC (rev 
15428)
@@ -414,7 +414,6 @@
                   "Asking core (1) to connect to peer `%4s'\n",
                   GNUNET_i2s (&p2.id));
       GNUNET_CORE_peer_request_connect (p1.ch,
-                                       GNUNET_TIME_UNIT_SECONDS,
                                        &p2.id,
                                        NULL, NULL);
     }

Modified: gnunet/src/core/test_core_quota_compliance.c
===================================================================
--- gnunet/src/core/test_core_quota_compliance.c        2011-06-05 13:25:21 UTC 
(rev 15427)
+++ gnunet/src/core/test_core_quota_compliance.c        2011-06-05 13:26:22 UTC 
(rev 15428)
@@ -562,7 +562,6 @@
                   GNUNET_i2s (&p2.id));
 #endif
       GNUNET_CORE_peer_request_connect (p1.ch,
-                                       GNUNET_TIME_UNIT_SECONDS,
                                        &p2.id,
                                        NULL, NULL);
     }

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/dht/gnunet-service-dht.c 2011-06-05 13:26:22 UTC (rev 15428)
@@ -2188,8 +2188,6 @@
               increment_stats (STAT_HELLOS_PROVIDED);
               GNUNET_TRANSPORT_offer_hello (transport_handle, hello_msg, NULL, 
NULL);
               GNUNET_CORE_peer_request_connect (coreAPI,
-                                                GNUNET_TIME_relative_multiply
-                                                (GNUNET_TIME_UNIT_SECONDS, 5),
                                                 &new_peer, NULL, NULL);
             }
         }
@@ -2712,8 +2710,6 @@
           increment_stats (STAT_HELLOS_PROVIDED);
           GNUNET_TRANSPORT_offer_hello (transport_handle, other_hello, NULL, 
NULL);
           GNUNET_CORE_peer_request_connect (coreAPI,
-                                            GNUNET_TIME_relative_multiply
-                                            (GNUNET_TIME_UNIT_SECONDS, 5),
                                             &peer_id, NULL, NULL);
           route_message (find_msg, msg_ctx);
           GNUNET_free (other_hello);

Modified: gnunet/src/include/gnunet_core_service.h
===================================================================
--- gnunet/src/include/gnunet_core_service.h    2011-06-05 13:25:21 UTC (rev 
15427)
+++ gnunet/src/include/gnunet_core_service.h    2011-06-05 13:26:22 UTC (rev 
15428)
@@ -266,7 +266,6 @@
  * be called with the TIMEOUT reason code.
  *
  * @param h core handle
- * @param timeout how long to try to talk to core
  * @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
@@ -274,7 +273,6 @@
  */
 struct GNUNET_CORE_PeerRequestHandle *
 GNUNET_CORE_peer_request_connect (struct GNUNET_CORE_Handle *h,
-                                 struct GNUNET_TIME_Relative timeout,
                                  const struct GNUNET_PeerIdentity * peer,
                                  GNUNET_CORE_ControlContinuation cont,
                                  void *cont_cls);

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/mesh/mesh_api.c  2011-06-05 13:26:22 UTC (rev 15428)
@@ -543,7 +543,6 @@
                                         handle->pending_tunnels.tail,
                                         tunnel);
       (void) GNUNET_CORE_peer_request_connect (handle->core,
-                                              timeout,
                                               peers,
                                               NULL, NULL);
     }

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/testing/testing.c        2011-06-05 13:26:22 UTC (rev 15428)
@@ -1788,7 +1788,6 @@
       GNUNET_assert (ctx->d1core != NULL);
       ctx->connect_request_handle =
         GNUNET_CORE_peer_request_connect (ctx->d1core,
-                                          ctx->relative_timeout,
                                           &ctx->d2->id,
                                           &core_connect_request_cont, ctx);
 
@@ -1831,7 +1830,6 @@
     {
       connect_ctx->connect_request_handle =
           GNUNET_CORE_peer_request_connect (connect_ctx->d1core,
-                                            connect_ctx->relative_timeout,
                                             &connect_ctx->d2->id,
                                             &core_connect_request_cont, 
connect_ctx);
       GNUNET_assert(connect_ctx->connect_request_handle != NULL);
@@ -1931,7 +1929,6 @@
     {
       ctx->connect_request_handle =
         GNUNET_CORE_peer_request_connect (ctx->d1core,
-                                          ctx->relative_timeout,
                                           &ctx->d2->id,
                                           &core_connect_request_cont, ctx);
     }

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2011-06-05 13:25:21 UTC (rev 15427)
+++ gnunet/src/testing/testing_group.c  2011-06-05 13:26:22 UTC (rev 15428)
@@ -3249,7 +3249,6 @@
         while (conn != NULL)
           {
             
GNUNET_CORE_peer_request_connect(send_hello_context->peer->daemon->server,
-                GNUNET_TIME_relative_get_forever(),
                 &send_hello_context->pg->peers[conn->index].daemon->id,
                 NULL,
                 NULL);

Modified: gnunet/src/topology/gnunet-daemon-topology.c
===================================================================
--- gnunet/src/topology/gnunet-daemon-topology.c        2011-06-05 13:25:21 UTC 
(rev 15427)
+++ gnunet/src/topology/gnunet-daemon-topology.c        2011-06-05 13:26:22 UTC 
(rev 15428)
@@ -268,7 +268,7 @@
 
 
 /**
- * Function called by core when our attempt to connect succeeded.
+ * Function called by core when our request to connect was transmitted.
  *
  * @param cls the 'struct Peer' for which we issued the connect request
  * @param success was the request transmitted
@@ -414,7 +414,6 @@
                            1,
                            GNUNET_NO);
   pos->connect_req = GNUNET_CORE_peer_request_connect (handle,
-                                                      GNUNET_TIME_UNIT_MINUTES,
                                                       &pos->pid,
                                                       
&connect_completed_callback,
                                                       pos);
@@ -932,7 +931,7 @@
 process_peer (void *cls,
              const struct GNUNET_PeerIdentity *peer,
              const struct GNUNET_HELLO_Message *hello,
-          const char *err_msg)
+             const char *err_msg)
 {
   struct Peer *pos;
 




reply via email to

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