From: Christian Grothoff Date: Sun, 23 Oct 2011 15:18:48 +0000 (+0000) Subject: Adding FIXMEs: if delay is FOREVER, session should be terminated X-Git-Tag: initial-import-from-subversion-38251~16315 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1207885b627afe3bcdb5fafa17a4edf2730882ef;p=oweals%2Fgnunet.git Adding FIXMEs: if delay is FOREVER, session should be terminated --- diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 784dd3002..430d13330 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c @@ -248,6 +248,7 @@ http_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) return GNUNET_OK; } + struct GNUNET_TIME_Relative http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer, const struct GNUNET_MessageHeader * message, diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index a2024953c..a27997d33 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c @@ -322,7 +322,11 @@ client_receive_mst_cb (void *cls, void *client, struct GNUNET_TIME_Relative delay; delay = http_plugin_receive (s, &s->target, message, s, s->addr, s->addrlen); - s->next_receive = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), delay); + if (delay.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) + { + // FIXME: terminate connection! + } + s->next_receive = GNUNET_TIME_relative_to_absolute (delay); if (GNUNET_TIME_absolute_get().abs_value < s->next_receive.abs_value) { diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 158532aca..7733c6323 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -278,8 +278,11 @@ server_receive_mst_cb (void *cls, void *client, struct GNUNET_TIME_Relative delay; delay = http_plugin_receive (s, &s->target, message, s, s->addr, s->addrlen); - - s->next_receive = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), delay); + if (delay.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) + { + // FIXME: terminate connection! + } + s->next_receive = GNUNET_TIME_relative_to_absolute (delay); if (delay.rel_value > 0) { diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 5a77f25b5..edbcb0e17 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -1685,6 +1685,8 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) NULL, 0); if (delay.rel_value == 0) GNUNET_SERVER_receive_done (session->client, GNUNET_OK); + else if (delay.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) + GNUNET_SERVER_receive_done (session->client, GNUNET_SYSERR); else session->receive_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &delayed_done, session); diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 9812416de..077fe38e3 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -861,6 +861,10 @@ process_inbound_tokenized_messages (void *cls, void *client, "Giving Session %X %s to transport\n", si->session, GNUNET_i2s(&si->session->target)); delay = plugin->env->receive (plugin->env->cls, &si->sender, hdr, &distance, 1, si->session, si->arg, si->args); + if (delay.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) + { + // FIXME: terminate session! + } si->session->flow_delay_for_other_peer = delay; } diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index b3faf4480..160b5924c 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -2333,7 +2333,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) GNUNET_assert (cls != NULL); struct Session *session = (struct Session *) client; struct Plugin *plugin = (struct Plugin *) cls; - + struct GNUNET_TIME_Relative delay; struct GNUNET_ATS_Information distance; distance.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); @@ -2348,11 +2348,16 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) htons (hdr->size)); #endif - plugin->env->receive (plugin->env->cls, &(session->target), hdr, - (const struct GNUNET_ATS_Information *) - &distance, 1, session, - (const char *) &session->mac->addr, - sizeof (session->mac->addr)); + delay = plugin->env->receive (plugin->env->cls, &(session->target), hdr, + (const struct GNUNET_ATS_Information *) + &distance, 1, session, + (const char *) &session->mac->addr, + sizeof (session->mac->addr)); + if (delay.rel_value == GNUNET_TIME_UNIT_FOREVER_REL.rel_value) + { + // FIXME: terminate session! + } + } /**