From: Matthias Wachs Date: Tue, 13 Sep 2011 08:48:47 +0000 (+0000) Subject: fix: ats data X-Git-Tag: initial-import-from-subversion-38251~17166 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=86fb62161c727487a28a303214ec260c64fd9fd5;p=oweals%2Fgnunet.git fix: ats data --- diff --git a/src/transport/gnunet-service-transport-new.c b/src/transport/gnunet-service-transport-new.c index 4b1becacd..d1ef887fd 100644 --- a/src/transport/gnunet-service-transport-new.c +++ b/src/transport/gnunet-service-transport-new.c @@ -165,7 +165,6 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_TIME_Relative ret; uint16_t type; - ret = GNUNET_TIME_UNIT_ZERO; if (NULL != message) { @@ -202,8 +201,8 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, (void) GST_blacklist_test_allowed (peer, NULL, &try_connect_if_allowed, NULL); /* TODO: if 'session != NULL', and timestamp more recent than the - previous one, maybe notify ATS that this is now the preferred - * way to communicate with this peer (other peer switched transport) */ + * previous one, maybe notify ATS that this is now the preferred + * * way to communicate with this peer (other peer switched transport) */ break; case GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT: /* TODO: do some validation to prevent an attacker from sending @@ -242,6 +241,9 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, break; } } + + GNUNET_assert ((ats_count > 0) && (ats != NULL)); + GNUNET_ATS_address_update (GST_ats, peer, GNUNET_TIME_absolute_get (), /* valid at least until right now... */ plugin_name, session, sender_address, sender_address_len, ats, ats_count); diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 452f55e1a..af253f964 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -1661,11 +1661,15 @@ delayed_done (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct Session *session = cls; struct GNUNET_TIME_Relative delay; + struct GNUNET_TRANSPORT_ATS_Information ats; + + ats.type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); + ats.value = htonl (0); session->receive_delay_task = GNUNET_SCHEDULER_NO_TASK; delay = session->plugin->env->receive (session->plugin->env->cls, - &session->target, NULL, NULL, 0, session, + &session->target, NULL, &ats, 1, session, NULL, 0); if (delay.rel_value == 0) GNUNET_SERVER_receive_done (session->client, GNUNET_OK);