new operation queue for limiting overlay connects
[oweals/gnunet.git] / src / transport / transport_api.c
index 81877743e0ed09df1381e23f8313bf5d62bc0e54..49f82e66b78b59fa80a71275ed5479006136ade9 100644 (file)
@@ -525,12 +525,11 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg)
     if (n == NULL)
       break;
 
-    GNUNET_assert (0 == n->traffic_overhead);
     if (bytes_physical >= bytes_msg)
     {
         LOG (GNUNET_ERROR_TYPE_DEBUG, "Overhead for %u byte message: %u \n",
             bytes_msg, bytes_physical - bytes_msg);
-      n->traffic_overhead = bytes_physical - bytes_msg;
+      n->traffic_overhead += bytes_physical - bytes_msg;
     }
     GNUNET_break (GNUNET_NO == n->is_ready);
     n->is_ready = GNUNET_YES;
@@ -1318,7 +1317,8 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle,
   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,