diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-16 14:30:22 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-10-16 14:30:22 +0000 |
commit | 99bf44f32c29c327f013db2e4406a2242606c1d5 (patch) | |
tree | 556bd5b0e2fd05403f24b5422d59184722e4f25a /src/transport | |
parent | 7c6e0bd5902d4ea469e793cba73f7116ff82292d (diff) | |
download | gnunet-99bf44f32c29c327f013db2e4406a2242606c1d5.tar.gz gnunet-99bf44f32c29c327f013db2e4406a2242606c1d5.zip |
stats + delay
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 28 | ||||
-rw-r--r-- | src/transport/transport_api.c | 3 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index e22110f5f..3afb11560 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -697,7 +697,25 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result) | |||
697 | * Transport continuation for unfragmented message | 697 | * Transport continuation for unfragmented message |
698 | * send_next_fragment for fragmented message | 698 | * send_next_fragment for fragmented message |
699 | */ | 699 | */ |
700 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, udpw->payload_size, udpw->msg_size); | 700 | if (NULL == udpw->frag_ctx) |
701 | { | ||
702 | /* Not fragmented message */ | ||
703 | if (udpw->msg_size >= udpw->payload_size) | ||
704 | { | ||
705 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
706 | "# bytes overhead transmitted via UDP", | ||
707 | udpw->msg_size - udpw->payload_size, GNUNET_NO); | ||
708 | } | ||
709 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, | ||
710 | udpw->payload_size, udpw->msg_size); | ||
711 | } | ||
712 | else if (GNUNET_OK == result) | ||
713 | { | ||
714 | /* Fragmented message: only call next_fragment continuation on success */ | ||
715 | udpw->cont (udpw->cont_cls, &udpw->session->target, result, | ||
716 | udpw->payload_size, udpw->msg_size); | ||
717 | } | ||
718 | |||
701 | } | 719 | } |
702 | 720 | ||
703 | } | 721 | } |
@@ -1769,7 +1787,13 @@ read_process_ack (struct Plugin *plugin, | |||
1769 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1787 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1770 | "Calling continuation for fragmented message to `%s' with result %s\n", | 1788 | "Calling continuation for fragmented message to `%s' with result %s\n", |
1771 | GNUNET_i2s (&s->target), "OK"); | 1789 | GNUNET_i2s (&s->target), "OK"); |
1772 | /* FIXME add overhead bytes here */ | 1790 | |
1791 | if (s->frag_ctx->on_wire_size >= s->frag_ctx->payload_size) | ||
1792 | { | ||
1793 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1794 | "# bytes overhead transmitted via UDP", | ||
1795 | s->frag_ctx->on_wire_size - s->frag_ctx->payload_size, GNUNET_NO); | ||
1796 | } | ||
1773 | s->frag_ctx->cont (s->frag_ctx->cont_cls, &udp_ack->sender, GNUNET_OK, | 1797 | s->frag_ctx->cont (s->frag_ctx->cont_cls, &udp_ack->sender, GNUNET_OK, |
1774 | s->frag_ctx->payload_size, s->frag_ctx->on_wire_size); | 1798 | s->frag_ctx->payload_size, s->frag_ctx->on_wire_size); |
1775 | } | 1799 | } |
diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 81877743e..a6496c973 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c | |||
@@ -1318,7 +1318,8 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, | |||
1318 | th->priority = priority; | 1318 | th->priority = priority; |
1319 | n->th = th; | 1319 | n->th = th; |
1320 | /* calculate when our transmission should be ready */ | 1320 | /* calculate when our transmission should be ready */ |
1321 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size); | 1321 | delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead); |
1322 | n->traffic_overhead = 0; | ||
1322 | if (delay.rel_value > timeout.rel_value) | 1323 | if (delay.rel_value > timeout.rel_value) |
1323 | delay.rel_value = 0; /* notify immediately (with failure) */ | 1324 | delay.rel_value = 0; /* notify immediately (with failure) */ |
1324 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1325 | LOG (GNUNET_ERROR_TYPE_DEBUG, |