gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10668 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r10668 - gnunet/src/transport
Date: Fri, 19 Mar 2010 14:55:30 +0100

Author: grothoff
Date: 2010-03-19 14:55:30 +0100 (Fri, 19 Mar 2010)
New Revision: 10668

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/plugin_transport_tcp.c
Log:
bi-di, no multicast PONG if reliable channel exists

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2010-03-19 13:42:36 UTC 
(rev 10667)
+++ gnunet/src/transport/gnunet-service-transport.c     2010-03-19 13:55:30 UTC 
(rev 10668)
@@ -23,9 +23,6 @@
  * @brief low-level P2P messaging
  * @author Christian Grothoff
  *
- * BUGS:
- * - bi-directional nature of TCP is not exploited
- *
  * NOTE:
  * - This code uses 'GNUNET_a2s' for debug printing in many places,
  *   which is technically wrong since it assumes we have IP+Port 
@@ -3003,17 +3000,50 @@
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CRYPTO_rsa_sign (my_private_key,
                                          &pong->purpose, &pong->signature));
-
   n = find_neighbour(peer);
   if (n == NULL)
     n = setup_new_neighbour(peer);
-  /* broadcast 'PONG' to all available addresses */
+  /* first try reliable response transmission */
   rl = n->plugins;
   while (rl != NULL)
     {
       fal = rl->addresses;
       while (fal != NULL)
        {
+         if (-1 != rl->plugin->api->send (rl->plugin->api->cls,
+                                          peer,
+                                          (const char*) pong,
+                                          ntohs (pong->header.size),
+                                          TRANSPORT_PONG_PRIORITY, 
+                                          HELLO_VERIFICATION_TIMEOUT,
+                                          fal->addr,
+                                          fal->addrlen,
+                                          GNUNET_SYSERR,
+                                          NULL, NULL))
+           {
+             /* done! */
+             GNUNET_STATISTICS_update (stats,
+                                       gettext_noop ("# PONGs unicast via 
reliable transport"),
+                                       1,
+                                       GNUNET_NO);      
+             GNUNET_free (pong);
+             return GNUNET_OK;
+           }
+         fal = fal->next;
+       }
+      rl = rl->next;
+    }
+  /* no reliable method found, do multicast */
+  GNUNET_STATISTICS_update (stats,
+                           gettext_noop ("# PONGs multicast to all available 
addresses"),
+                           1,
+                           GNUNET_NO);      
+  rl = n->plugins;
+  while (rl != NULL)
+    {
+      fal = rl->addresses;
+      while (fal != NULL)
+       {
          transmit_to_peer(NULL, fal,
                           TRANSPORT_PONG_PRIORITY, 
                           HELLO_VERIFICATION_TIMEOUT,

Modified: gnunet/src/transport/plugin_transport_tcp.c
===================================================================
--- gnunet/src/transport/plugin_transport_tcp.c 2010-03-19 13:42:36 UTC (rev 
10667)
+++ gnunet/src/transport/plugin_transport_tcp.c 2010-03-19 13:55:30 UTC (rev 
10668)
@@ -1110,6 +1110,7 @@
       GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
       return;
     }
+  session->last_activity = GNUNET_TIME_absolute_get ();
   session->expecting_welcome = GNUNET_NO;
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }





reply via email to

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