aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-10-22 12:36:41 +0000
committerChristian Grothoff <christian@grothoff.org>2012-10-22 12:36:41 +0000
commitddd69826be47a1956c6972c2cfcadfa7902b8639 (patch)
treedd632db2ba084a1a83b0ef57189333f2bbd354a6 /src/transport/plugin_transport_udp.c
parent582f893b55d9536864b59ad3ccb1dfeb43ff31b7 (diff)
downloadgnunet-ddd69826be47a1956c6972c2cfcadfa7902b8639.tar.gz
gnunet-ddd69826be47a1956c6972c2cfcadfa7902b8639.zip
-trying to fix fragmentation / udp performance, not working yet
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c53
1 files changed, 27 insertions, 26 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index b6b13eab2..18791c264 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -128,7 +128,12 @@ struct Session
128 /** 128 /**
129 * expected delay for ACKs 129 * expected delay for ACKs
130 */ 130 */
131 struct GNUNET_TIME_Relative last_expected_delay; 131 struct GNUNET_TIME_Relative last_expected_ack_delay;
132
133 /**
134 * desired delay between UDP messages
135 */
136 struct GNUNET_TIME_Relative last_expected_msg_delay;
132 137
133 struct GNUNET_ATS_Information ats; 138 struct GNUNET_ATS_Information ats;
134 139
@@ -290,7 +295,7 @@ struct UDP_FragmentationContext
290 size_t on_wire_size; 295 size_t on_wire_size;
291 296
292 unsigned int fragments_used; 297 unsigned int fragments_used;
293 struct GNUNET_TIME_Relative exp_delay; 298
294}; 299};
295 300
296 301
@@ -971,9 +976,9 @@ udp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
971static void 976static void
972free_session (struct Session *s) 977free_session (struct Session *s)
973{ 978{
974 if (s->frag_ctx != NULL) 979 if (NULL != s->frag_ctx)
975 { 980 {
976 GNUNET_FRAGMENT_context_destroy(s->frag_ctx->frag); 981 GNUNET_FRAGMENT_context_destroy(s->frag_ctx->frag, NULL, NULL);
977 GNUNET_free (s->frag_ctx); 982 GNUNET_free (s->frag_ctx);
978 s->frag_ctx = NULL; 983 s->frag_ctx = NULL;
979 } 984 }
@@ -1236,7 +1241,8 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
1236 s->addrlen = len; 1241 s->addrlen = len;
1237 s->target = *target; 1242 s->target = *target;
1238 s->sock_addr = (const struct sockaddr *) &s[1]; 1243 s->sock_addr = (const struct sockaddr *) &s[1];
1239 s->last_expected_delay = GNUNET_TIME_UNIT_SECONDS; 1244 s->last_expected_ack_delay = GNUNET_TIME_UNIT_SECONDS;
1245 s->last_expected_msg_delay = GNUNET_TIME_UNIT_MILLISECONDS;
1240 s->flow_delay_from_other_peer = GNUNET_TIME_UNIT_ZERO_ABS; 1246 s->flow_delay_from_other_peer = GNUNET_TIME_UNIT_ZERO_ABS;
1241 s->flow_delay_for_other_peer = GNUNET_TIME_UNIT_ZERO; 1247 s->flow_delay_for_other_peer = GNUNET_TIME_UNIT_ZERO;
1242 start_session_timeout (s); 1248 start_session_timeout (s);
@@ -1561,17 +1567,17 @@ udp_plugin_send (void *cls,
1561 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);
1562 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 */
1563 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);
1564 frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats, 1573 frag_ctx->frag = GNUNET_FRAGMENT_context_create (plugin->env->stats,
1565 UDP_MTU, 1574 UDP_MTU,
1566 &plugin->tracker, 1575 &plugin->tracker,
1567 GNUNET_TIME_relative_max (s->last_expected_delay, GNUNET_TIME_UNIT_SECONDS), 1576 s->last_expected_msg_delay,
1568 &udp->header, 1577 s->last_expected_ack_delay,
1569 &enqueue_fragment, 1578 &udp->header,
1570 frag_ctx); 1579 &enqueue_fragment,
1571 1580 frag_ctx);
1572 frag_ctx->exp_delay = s->last_expected_delay;
1573 s->frag_ctx = frag_ctx;
1574
1575 GNUNET_STATISTICS_update (plugin->env->stats, 1581 GNUNET_STATISTICS_update (plugin->env->stats,
1576 "# UDP, fragmented msgs, messages, pending", 1582 "# UDP, fragmented msgs, messages, pending",
1577 1, GNUNET_NO); 1583 1, GNUNET_NO);
@@ -1964,7 +1970,9 @@ read_process_ack (struct Plugin *plugin,
1964 "Message full ACK'ed\n", 1970 "Message full ACK'ed\n",
1965 (unsigned int) ntohs (msg->size), GNUNET_i2s (&udp_ack->sender), 1971 (unsigned int) ntohs (msg->size), GNUNET_i2s (&udp_ack->sender),
1966 GNUNET_a2s ((const struct sockaddr *) addr, fromlen)); 1972 GNUNET_a2s ((const struct sockaddr *) addr, fromlen));
1967 s->last_expected_delay = GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag); 1973 GNUNET_FRAGMENT_context_destroy (s->frag_ctx->frag,
1974 &s->last_expected_msg_delay,
1975 &s->last_expected_ack_delay);
1968 1976
1969 if (s->addrlen == sizeof (struct sockaddr_in6)) 1977 if (s->addrlen == sizeof (struct sockaddr_in6))
1970 { 1978 {
@@ -1994,15 +2002,6 @@ read_process_ack (struct Plugin *plugin,
1994 udpw = tmp; 2002 udpw = tmp;
1995 } 2003 }
1996 } 2004 }
1997/*
1998 LOG (GNUNET_ERROR_TYPE_ERROR,
1999 "Fragmented message sent: fragments needed: %u , payload %u bytes, used on wire %u bytes, overhead: %f, expected delay: %llu\n",
2000 s->frag_ctx->fragments_used,
2001 s->frag_ctx->payload_size,
2002 s->frag_ctx->on_wire_size,
2003 ((float) s->frag_ctx->on_wire_size) / s->frag_ctx->payload_size,
2004 s->frag_ctx->exp_delay.rel_value);
2005*/
2006 dummy.msg_type = MSG_FRAGMENTED_COMPLETE; 2005 dummy.msg_type = MSG_FRAGMENTED_COMPLETE;
2007 dummy.msg_buf = NULL; 2006 dummy.msg_buf = NULL;
2008 dummy.msg_size = s->frag_ctx->on_wire_size; 2007 dummy.msg_size = s->frag_ctx->on_wire_size;
@@ -2190,7 +2189,9 @@ remove_timeout_messages_and_select (struct UDP_MessageWrapper *head,
2190 LOG (GNUNET_ERROR_TYPE_DEBUG, 2189 LOG (GNUNET_ERROR_TYPE_DEBUG,
2191 "Fragment for message for peer `%s' with size %u timed out\n", 2190 "Fragment for message for peer `%s' with size %u timed out\n",
2192 GNUNET_i2s(&udpw->session->target), udpw->frag_ctx->payload_size); 2191 GNUNET_i2s(&udpw->session->target), udpw->frag_ctx->payload_size);
2193 udpw->session->last_expected_delay = GNUNET_FRAGMENT_context_destroy (udpw->frag_ctx->frag); 2192 GNUNET_FRAGMENT_context_destroy (udpw->frag_ctx->frag,
2193 &udpw->session->last_expected_msg_delay,
2194 &udpw->session->last_expected_ack_delay);
2194 GNUNET_free (udpw->frag_ctx); 2195 GNUNET_free (udpw->frag_ctx);
2195 udpw->session->frag_ctx = NULL; 2196 udpw->session->frag_ctx = NULL;
2196 2197