From: Matthias Wachs Date: Mon, 13 Feb 2012 15:38:33 +0000 (+0000) Subject: new sending in validation X-Git-Tag: initial-import-from-subversion-38251~14867 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b9e61b9c3832e69164ee8574fff6711b2f18ef6;p=oweals%2Fgnunet.git new sending in validation --- diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 17fc5edc6..83940d43d 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -481,11 +481,24 @@ transmit_ping_if_allowed (void *cls, const struct GNUNET_PeerIdentity *pid, else { GNUNET_assert (papi->send != NULL); - ret = - papi->send (papi->cls, pid, message_buf, tsize, PING_PRIORITY, - ACCEPTABLE_PING_DELAY, NULL /* no session */ , - ve->address->address, ve->address->address_length, - GNUNET_YES, NULL, NULL); + GNUNET_assert (papi->get_session != NULL); + struct Session * session = papi->get_session(papi->cls, ve->address); + + if (session != NULL) + { + ret = papi->send_with_session (papi->cls, session, + message_buf, tsize, + PING_PRIORITY, ACCEPTABLE_PING_DELAY, + NULL, NULL); + } + else + { + /* Could not get a valid session */ + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not get a valid session for `%s' %s\n", + GNUNET_i2s (pid), GST_plugins_a2s (ve->address)); + GNUNET_break (0); + ret = -1; + } } } if (-1 != ret) @@ -727,10 +740,21 @@ multicast_pong (void *cls, papi = GST_plugins_find (address->transport_name); if (papi == NULL) return; - (void) papi->send (papi->cls, &address->peer, (const char *) pong, - ntohs (pong->header.size), PONG_PRIORITY, - ACCEPTABLE_PING_DELAY, NULL, address->address, - address->address_length, GNUNET_YES, NULL, NULL); + + GNUNET_assert (papi->send != NULL); + GNUNET_assert (papi->get_session != NULL); + + struct Session * session = papi->get_session(papi->cls, address); + if (session == NULL) + { + GNUNET_break (0); + return; + } + + papi->send_with_session (papi->cls, session, + (const char *) pong, ntohs (pong->header.size), + PONG_PRIORITY, ACCEPTABLE_PING_DELAY, + NULL, NULL); } @@ -862,11 +886,27 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, if (papi == NULL) ret = -1; else - ret = - papi->send (papi->cls, sender, (const char *) pong, - ntohs (pong->header.size), PONG_PRIORITY, - ACCEPTABLE_PING_DELAY, session, sender_address->address, - sender_address->address_length, GNUNET_SYSERR, NULL, NULL); + { + GNUNET_assert (papi->send != NULL); + GNUNET_assert (papi->get_session != NULL); + + if ((session == NULL) && (sender_address != NULL)) + { + session = papi->get_session (papi->cls, sender_address); + } + if (session == NULL) + { + GNUNET_break (0); + ret = -1; + } + else + { + ret = papi->send_with_session (papi->cls, session, + (const char *) pong, ntohs (pong->header.size), + PONG_PRIORITY, ACCEPTABLE_PING_DELAY, + NULL, NULL); + } + } if (ret != -1) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index 9e16e93c8..be8f93dd2 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h @@ -42,10 +42,10 @@ #include -#define DEBUG_HTTP GNUNET_YES +#define DEBUG_HTTP GNUNET_EXTRA_LOGGING #define VERBOSE_SERVER GNUNET_EXTRA_LOGGING #define VERBOSE_CLIENT GNUNET_EXTRA_LOGGING -#define VERBOSE_CURL GNUNET_NO +#define VERBOSE_CURL GNUNET_EXTRA_LOGGING #if BUILD_HTTPS #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init