gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r24342 - gnunet/src/transport
Date: Tue, 16 Oct 2012 16:30:22 +0200

Author: wachs
Date: 2012-10-16 16:30:22 +0200 (Tue, 16 Oct 2012)
New Revision: 24342

Modified:
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/transport_api.c
Log:
stats + delay

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-10-16 13:25:39 UTC (rev 
24341)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-10-16 14:30:22 UTC (rev 
24342)
@@ -697,7 +697,25 @@
      * Transport continuation for unfragmented message
      * send_next_fragment for fragmented message
      */
-    udpw->cont (udpw->cont_cls, &udpw->session->target, result, 
udpw->payload_size, udpw->msg_size);
+    if (NULL == udpw->frag_ctx)
+    {
+        /* Not fragmented message */
+        if (udpw->msg_size >= udpw->payload_size)
+        {
+            GNUNET_STATISTICS_update (plugin->env->stats,
+                                  "# bytes overhead transmitted via UDP",
+                                  udpw->msg_size - udpw->payload_size, 
GNUNET_NO);
+        }
+        udpw->cont (udpw->cont_cls, &udpw->session->target, result,
+                    udpw->payload_size, udpw->msg_size);
+    }
+    else if (GNUNET_OK == result)
+    {
+        /* Fragmented message: only call next_fragment continuation on success 
*/
+        udpw->cont (udpw->cont_cls, &udpw->session->target, result,
+                    udpw->payload_size, udpw->msg_size);
+    }
+
   }
 
 }
@@ -1769,7 +1787,13 @@
     LOG (GNUNET_ERROR_TYPE_DEBUG,
         "Calling continuation for fragmented message to `%s' with result %s\n",
         GNUNET_i2s (&s->target), "OK");
-    /* FIXME add overhead bytes here */
+
+    if (s->frag_ctx->on_wire_size >= s->frag_ctx->payload_size)
+    {
+        GNUNET_STATISTICS_update (plugin->env->stats,
+                              "# bytes overhead transmitted via UDP",
+                              s->frag_ctx->on_wire_size - 
s->frag_ctx->payload_size, GNUNET_NO);
+    }
     s->frag_ctx->cont (s->frag_ctx->cont_cls, &udp_ack->sender, GNUNET_OK,
                        s->frag_ctx->payload_size, s->frag_ctx->on_wire_size);
   }

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2012-10-16 13:25:39 UTC (rev 
24341)
+++ gnunet/src/transport/transport_api.c        2012-10-16 14:30:22 UTC (rev 
24342)
@@ -1318,7 +1318,8 @@
   th->priority = priority;
   n->th = th;
   /* calculate when our transmission should be ready */
-  delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size);
+  delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + 
n->traffic_overhead);
+  n->traffic_overhead = 0;
   if (delay.rel_value > timeout.rel_value)
     delay.rel_value = 0;        /* notify immediately (with failure) */
   LOG (GNUNET_ERROR_TYPE_DEBUG,




reply via email to

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