diff options
-rw-r--r-- | src/fragmentation/fragmentation.c | 10 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 26 |
2 files changed, 16 insertions, 20 deletions
diff --git a/src/fragmentation/fragmentation.c b/src/fragmentation/fragmentation.c index 19f7ff175..3924fc41f 100644 --- a/src/fragmentation/fragmentation.c +++ b/src/fragmentation/fragmentation.c | |||
@@ -228,9 +228,7 @@ transmit_next (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
228 | { | 228 | { |
229 | /* full round transmitted wait 2x delay for ACK before going again */ | 229 | /* full round transmitted wait 2x delay for ACK before going again */ |
230 | fc->num_rounds++; | 230 | fc->num_rounds++; |
231 | delay = GNUNET_TIME_relative_multiply (delay, 2); | 231 | delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2); |
232 | fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay, | ||
233 | 2 + (size / (fc->mtu - sizeof (struct FragmentHeader)))); | ||
234 | /* never use zero, need some time for ACK always */ | 232 | /* never use zero, need some time for ACK always */ |
235 | delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); | 233 | delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay); |
236 | fc->wack = GNUNET_YES; | 234 | fc->wack = GNUNET_YES; |
@@ -353,7 +351,6 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
353 | unsigned int snd_cnt; | 351 | unsigned int snd_cnt; |
354 | unsigned int i; | 352 | unsigned int i; |
355 | 353 | ||
356 | fprintf (stderr, "Got ACK!\n"); | ||
357 | if (sizeof (struct FragmentAcknowledgement) != ntohs (msg->size)) | 354 | if (sizeof (struct FragmentAcknowledgement) != ntohs (msg->size)) |
358 | { | 355 | { |
359 | GNUNET_break_op (0); | 356 | GNUNET_break_op (0); |
@@ -393,16 +390,15 @@ GNUNET_FRAGMENT_process_ack (struct GNUNET_FRAGMENT_Context *fc, | |||
393 | else if (snd_cnt > ack_cnt) | 390 | else if (snd_cnt > ack_cnt) |
394 | { | 391 | { |
395 | /* some loss, slow down proportionally */ | 392 | /* some loss, slow down proportionally */ |
393 | fprintf (stderr, "Prop loss\n"); | ||
396 | fc->msg_delay.rel_value = ((fc->msg_delay.rel_value * ack_cnt) / snd_cnt); | 394 | fc->msg_delay.rel_value = ((fc->msg_delay.rel_value * ack_cnt) / snd_cnt); |
397 | } | 395 | } |
398 | else if (0 < fc->msg_delay.rel_value) | 396 | else if (0 < fc->msg_delay.rel_value) |
399 | { | 397 | { |
400 | fc->msg_delay.rel_value--; /* try a bit faster */ | 398 | fc->msg_delay.rel_value--; /* try a bit faster */ |
401 | } | 399 | } |
402 | fc->msg_delay = GNUNET_TIME_relative_max (fc->msg_delay, | 400 | fc->msg_delay = GNUNET_TIME_relative_min (fc->msg_delay, |
403 | GNUNET_TIME_UNIT_SECONDS); | 401 | GNUNET_TIME_UNIT_SECONDS); |
404 | fprintf (stderr, "New msg delay: %llu\n", | ||
405 | (unsigned long long )fc->msg_delay.rel_value); | ||
406 | } | 402 | } |
407 | GNUNET_STATISTICS_update (fc->stats, | 403 | GNUNET_STATISTICS_update (fc->stats, |
408 | _("# fragment acknowledgements received"), 1, | 404 | _("# fragment acknowledgements received"), 1, |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 18791c264..630af4bfa 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1241,7 +1241,7 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
1241 | s->addrlen = len; | 1241 | s->addrlen = len; |
1242 | s->target = *target; | 1242 | s->target = *target; |
1243 | s->sock_addr = (const struct sockaddr *) &s[1]; | 1243 | s->sock_addr = (const struct sockaddr *) &s[1]; |
1244 | s->last_expected_ack_delay = GNUNET_TIME_UNIT_SECONDS; | 1244 | s->last_expected_ack_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 250); |
1245 | s->last_expected_msg_delay = GNUNET_TIME_UNIT_MILLISECONDS; | 1245 | s->last_expected_msg_delay = GNUNET_TIME_UNIT_MILLISECONDS; |
1246 | s->flow_delay_from_other_peer = GNUNET_TIME_UNIT_ZERO_ABS; | 1246 | s->flow_delay_from_other_peer = GNUNET_TIME_UNIT_ZERO_ABS; |
1247 | s->flow_delay_for_other_peer = GNUNET_TIME_UNIT_ZERO; | 1247 | s->flow_delay_for_other_peer = GNUNET_TIME_UNIT_ZERO; |
@@ -1567,9 +1567,6 @@ udp_plugin_send (void *cls, | |||
1567 | frag_ctx->timeout = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), to); | 1567 | frag_ctx->timeout = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), to); |
1568 | frag_ctx->payload_size = msgbuf_size; /* unfragmented message size without UDP overhead */ | 1568 | frag_ctx->payload_size = msgbuf_size; /* unfragmented message size without UDP overhead */ |
1569 | frag_ctx->on_wire_size = 0; /* bytes with UDP and fragmentation overhead */ | 1569 | frag_ctx->on_wire_size = 0; /* bytes with UDP and fragmentation overhead */ |
1570 | fprintf (stderr, "New fc with msg delay: %llu and ack delay %llu\n", | ||
1571 | (unsigned long long )s->last_expected_msg_delay.rel_value, | ||
1572 | (unsigned long long )s->last_expected_ack_delay.rel_value); | ||
1573 | frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats, | 1570 | frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats, |
1574 | UDP_MTU, | 1571 | UDP_MTU, |
1575 | &plugin->tracker, | 1572 | &plugin->tracker, |
@@ -1578,6 +1575,7 @@ udp_plugin_send (void *cls, | |||
1578 | &udp->header, | 1575 | &udp->header, |
1579 | &enqueue_fragment, | 1576 | &enqueue_fragment, |
1580 | frag_ctx); | 1577 | frag_ctx); |
1578 | s->frag_ctx = frag_ctx; | ||
1581 | GNUNET_STATISTICS_update (plugin->env->stats, | 1579 | GNUNET_STATISTICS_update (plugin->env->stats, |
1582 | "# UDP, fragmented msgs, messages, pending", | 1580 | "# UDP, fragmented msgs, messages, pending", |
1583 | 1, GNUNET_NO); | 1581 | 1, GNUNET_NO); |
@@ -1850,8 +1848,8 @@ ack_proc (void *cls, uint32_t id, const struct GNUNET_MessageHeader *msg) | |||
1850 | uint32_t delay = 0; | 1848 | uint32_t delay = 0; |
1851 | struct UDP_MessageWrapper *udpw; | 1849 | struct UDP_MessageWrapper *udpw; |
1852 | struct Session *s; | 1850 | struct Session *s; |
1853 | |||
1854 | struct LookupContext l_ctx; | 1851 | struct LookupContext l_ctx; |
1852 | |||
1855 | l_ctx.addr = rc->src_addr; | 1853 | l_ctx.addr = rc->src_addr; |
1856 | l_ctx.addrlen = rc->addr_len; | 1854 | l_ctx.addrlen = rc->addr_len; |
1857 | l_ctx.res = NULL; | 1855 | l_ctx.res = NULL; |
@@ -1913,8 +1911,8 @@ read_process_ack (struct Plugin *plugin, | |||
1913 | socklen_t fromlen) | 1911 | socklen_t fromlen) |
1914 | { | 1912 | { |
1915 | struct UDP_MessageWrapper dummy; | 1913 | struct UDP_MessageWrapper dummy; |
1916 | struct UDP_MessageWrapper * udpw; | 1914 | struct UDP_MessageWrapper *udpw; |
1917 | struct UDP_MessageWrapper * tmp; | 1915 | struct UDP_MessageWrapper *tmp; |
1918 | const struct GNUNET_MessageHeader *ack; | 1916 | const struct GNUNET_MessageHeader *ack; |
1919 | const struct UDP_ACK_Message *udp_ack; | 1917 | const struct UDP_ACK_Message *udp_ack; |
1920 | struct LookupContext l_ctx; | 1918 | struct LookupContext l_ctx; |
@@ -1932,15 +1930,18 @@ read_process_ack (struct Plugin *plugin, | |||
1932 | l_ctx.addrlen = fromlen; | 1930 | l_ctx.addrlen = fromlen; |
1933 | l_ctx.res = NULL; | 1931 | l_ctx.res = NULL; |
1934 | GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, | 1932 | GNUNET_CONTAINER_multihashmap_iterate (plugin->sessions, |
1935 | &lookup_session_by_addr_it, | 1933 | &lookup_session_by_addr_it, |
1936 | &l_ctx); | 1934 | &l_ctx); |
1937 | s = l_ctx.res; | 1935 | s = l_ctx.res; |
1938 | 1936 | ||
1939 | if ((s == NULL) || (s->frag_ctx == NULL)) | 1937 | if ((NULL == s) || (NULL == s->frag_ctx)) |
1938 | { | ||
1940 | return; | 1939 | return; |
1940 | } | ||
1941 | 1941 | ||
1942 | flow_delay.rel_value = (uint64_t) ntohl (udp_ack->delay); | 1942 | flow_delay.rel_value = (uint64_t) ntohl (udp_ack->delay); |
1943 | LOG (GNUNET_ERROR_TYPE_DEBUG, "We received a sending delay of %llu\n", | 1943 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1944 | "We received a sending delay of %llu\n", | ||
1944 | flow_delay.rel_value); | 1945 | flow_delay.rel_value); |
1945 | s->flow_delay_from_other_peer = | 1946 | s->flow_delay_from_other_peer = |
1946 | GNUNET_TIME_relative_to_absolute (flow_delay); | 1947 | GNUNET_TIME_relative_to_absolute (flow_delay); |
@@ -1955,7 +1956,6 @@ read_process_ack (struct Plugin *plugin, | |||
1955 | 1956 | ||
1956 | if (0 != memcmp (&l_ctx.res->target, &udp_ack->sender, sizeof (struct GNUNET_PeerIdentity))) | 1957 | if (0 != memcmp (&l_ctx.res->target, &udp_ack->sender, sizeof (struct GNUNET_PeerIdentity))) |
1957 | GNUNET_break (0); | 1958 | GNUNET_break (0); |
1958 | |||
1959 | if (GNUNET_OK != GNUNET_FRAGMENT_process_ack (s->frag_ctx->frag, ack)) | 1959 | if (GNUNET_OK != GNUNET_FRAGMENT_process_ack (s->frag_ctx->frag, ack)) |
1960 | { | 1960 | { |
1961 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1961 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1994,7 +1994,7 @@ read_process_ack (struct Plugin *plugin, | |||
1994 | while (udpw!= NULL) | 1994 | while (udpw!= NULL) |
1995 | { | 1995 | { |
1996 | tmp = udpw->next; | 1996 | tmp = udpw->next; |
1997 | if ((udpw->frag_ctx != NULL) && (udpw->frag_ctx == s->frag_ctx)) | 1997 | if ((NULL != udpw->frag_ctx) && (udpw->frag_ctx == s->frag_ctx)) |
1998 | { | 1998 | { |
1999 | dequeue (plugin, udpw); | 1999 | dequeue (plugin, udpw); |
2000 | GNUNET_free (udpw); | 2000 | GNUNET_free (udpw); |