gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r15970 - gnunet/src/transport
Date: Thu, 14 Jul 2011 19:45:17 +0200

Author: grothoff
Date: 2011-07-14 19:45:16 +0200 (Thu, 14 Jul 2011)
New Revision: 15970

Modified:
   gnunet/src/transport/Makefile.am
   gnunet/src/transport/plugin_transport_udp_new.c
Log:
reliable udp

Modified: gnunet/src/transport/Makefile.am
===================================================================
--- gnunet/src/transport/Makefile.am    2011-07-14 17:37:57 UTC (rev 15969)
+++ gnunet/src/transport/Makefile.am    2011-07-14 17:45:16 UTC (rev 15970)
@@ -187,9 +187,10 @@
   $(GN_PLUGIN_LDFLAGS)
 
 libgnunet_plugin_transport_udp_la_SOURCES = \
-  plugin_transport_udp.c
+  plugin_transport_udp_new.c
 libgnunet_plugin_transport_udp_la_LIBADD = \
   $(top_builddir)/src/hello/libgnunethello.la \
+  $(top_builddir)/src/fragmentation/libgnunetfragmentation.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
   $(top_builddir)/src/nat/libgnunetnat.la \

Modified: gnunet/src/transport/plugin_transport_udp_new.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp_new.c     2011-07-14 17:37:57 UTC 
(rev 15969)
+++ gnunet/src/transport/plugin_transport_udp_new.c     2011-07-14 17:45:16 UTC 
(rev 15970)
@@ -236,6 +236,11 @@
   struct GNUNET_SERVER_MessageStreamTokenizer *mst;
 
   /**
+   * Bandwidth tracker to limit global UDP traffic.
+   */
+  struct GNUNET_BANDWIDTH_Tracker tracker;
+
+  /**
    * Address we were told to bind to exclusively (IPv4).
    */
   char *bind4_address;
@@ -266,6 +271,11 @@
   struct GNUNET_NETWORK_Handle *sockv6;
 
   /**
+   * expected delay for ACKs 
+   */
+  struct GNUNET_TIME_Relative last_expected_delay;
+
+  /**
    * Port we listen on.
    */
   uint16_t port;
@@ -314,7 +324,7 @@
                 GNUNET_CONTAINER_multihashmap_remove (plugin->sessions,
                                                       &target->hashPubKey,
                                                       session));
-  (void) GNUNET_FRAGMENT_context_destroy (session->frag);
+  plugin->last_expected_delay = GNUNET_FRAGMENT_context_destroy 
(session->frag);
   session->cont (session->cont_cls, target, GNUNET_SYSERR);
   GNUNET_free (session);
 }
@@ -518,8 +528,8 @@
                                                        
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
       peer_session->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats,
                                                           UDP_MTU,
-                                                          NULL /* tracker; 
FIXME: add later to limit send rate... */,
-                                                          
GNUNET_TIME_UNIT_SECONDS /* expected delay for ACKs */,
+                                                          &plugin->tracker,
+                                                          
plugin->last_expected_delay,
                                                           &udp->header,
                                                           &send_fragment,
                                                           peer_session);
@@ -1313,6 +1323,7 @@
   socklen_t addrlens[2];
   socklen_t addrlen;
   unsigned int tries;
+  unsigned long long udp_max_bps;
 
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (env->cfg,
@@ -1323,6 +1334,12 @@
   if (GNUNET_OK !=
       GNUNET_CONFIGURATION_get_value_number (env->cfg,
                                             "transport-udp",
+                                            "MAX_BPS",
+                                            &udp_max_bps))
+    udp_max_bps = 1024 * 1024 * 100; /* 100 MB/s == infinity for practical 
purposes */
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_number (env->cfg,
+                                            "transport-udp",
                                             "ADVERTISED_PORT",
                                             &aport))
     aport = port;
@@ -1339,6 +1356,10 @@
   memset (&serverAddrv4, 0, sizeof (serverAddrv4));
 
   plugin = GNUNET_malloc (sizeof (struct Plugin));
+  GNUNET_BANDWIDTH_tracker_init (&plugin->tracker,
+                                GNUNET_BANDWIDTH_value_init ((uint32_t) 
udp_max_bps),
+                                30);
+  plugin->last_expected_delay = GNUNET_TIME_UNIT_SECONDS;
   plugin->port = port;
   plugin->aport = aport;
   plugin->env = env;




reply via email to

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