From 4f4c12e9fc90d7afe7c50db16b4c3b93f07765c5 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Fri, 16 Jul 2010 07:57:37 +0000 Subject: [PATCH] --- src/transport/plugin_transport_http.c | 22 ++++++++++--------- .../test_plugin_transport_data_http.conf | 5 ++++- src/transport/test_plugin_transport_http.c | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index da298308e..dd98dd84e 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c @@ -40,11 +40,11 @@ #include "microhttpd.h" #include - +#define VERBOSE GNUNET_NO #define DEBUG_CURL GNUNET_NO #define DEBUG_HTTP GNUNET_NO #define DEBUG_CONNECTIONS GNUNET_NO -#define DEBUG_SESSION_SELECTION GNUNET_YES +#define DEBUG_SESSION_SELECTION GNUNET_NO #define INBOUND GNUNET_NO #define OUTBOUND GNUNET_YES @@ -448,7 +448,9 @@ static int remove_session (struct HTTP_PeerContext * pc, struct Session * ps, i struct HTTP_Message * msg; struct Plugin * plugin = ps->peercontext->plugin; +#if DEBUG_CONNECTIONS GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: removing %s session %X with id %u\n", ps, (ps->direction == INBOUND) ? "inbound" : "outbound", ps, ps->session_id); +#endif plugin->env->session_end(plugin, &pc->identity, ps); GNUNET_free_non_null (ps->addr); @@ -1637,7 +1639,7 @@ static ssize_t send_check_connections (void *cls, struct Session *ps) return GNUNET_SYSERR; } -static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *pc, const void * addr, size_t addrlen, int force_address, struct Session * session) +static struct Session * send_select_session (void * cls, struct HTTP_PeerContext *pc, const void * addr, size_t addrlen, int force_address, struct Session * session) { struct Session * tmp = NULL; int addr_given = GNUNET_NO; @@ -1655,7 +1657,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p /* connection can not be used, since it is disconnected */ if ((session->recv_force_disconnect==GNUNET_NO) && (session->send_force_disconnect==GNUNET_NO)) { -#ifdef DEBUG_SESSION_SELECTION +#if DEBUG_SESSION_SELECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using session passed by transport to send to forced address \n", session); #endif return session; @@ -1670,7 +1672,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p /* connection can not be used, since it is disconnected */ if ((pc->last_session->recv_force_disconnect==GNUNET_NO) && (pc->last_session->send_force_disconnect==GNUNET_NO)) { -#ifdef DEBUG_SESSION_SELECTION +#if DEBUG_SESSION_SELECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using last session used to send to forced address \n", pc->last_session); #endif return pc->last_session; @@ -1687,7 +1689,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p /* connection can not be used, since it is disconnected */ if ((tmp->recv_force_disconnect==GNUNET_NO) && (tmp->send_force_disconnect==GNUNET_NO)) { -#ifdef DEBUG_SESSION_SELECTION +#if DEBUG_SESSION_SELECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using existing session to send to forced address \n", session); #endif return session; @@ -1707,7 +1709,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p /* connection can not be used, since it is disconnected */ if ((session->recv_force_disconnect==GNUNET_NO) && (session->send_force_disconnect==GNUNET_NO)) { -#ifdef DEBUG_SESSION_SELECTION +#if DEBUG_SESSION_SELECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using session passed by transport to send not-forced address \n", session); #endif return session; @@ -1720,7 +1722,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p /* connection can not be used, since it is disconnected */ if ((pc->last_session->recv_force_disconnect==GNUNET_NO) && (pc->last_session->send_force_disconnect==GNUNET_NO)) { -#ifdef DEBUG_SESSION_SELECTION +#if DEBUG_SESSION_SELECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using last session to send to not-forced address \n", pc->last_session); #endif return pc->last_session; @@ -1733,7 +1735,7 @@ static struct Session * send_get_session (void * cls, struct HTTP_PeerContext *p /* connection can not be used, since it is disconnected */ if ((tmp->recv_force_disconnect==GNUNET_NO) && (tmp->send_force_disconnect==GNUNET_NO)) { -#ifdef DEBUG_SESSION_SELECTION +#if DEBUG_SESSION_SELECTION GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session %X selected: Using existing session to send to not-forced address \n", tmp); #endif return tmp; @@ -1831,7 +1833,7 @@ http_plugin_send (void *cls, GNUNET_CONTAINER_multihashmap_put(plugin->peers, &pc->identity.hashPubKey, pc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); } - ps = send_get_session (plugin, pc, addr, addrlen, force_address, session); + ps = send_select_session (plugin, pc, addr, addrlen, force_address, session); /* session not existing, but address forced -> creating new session */ if (ps==NULL) diff --git a/src/transport/test_plugin_transport_data_http.conf b/src/transport/test_plugin_transport_data_http.conf index a536b8e3a..80a615b7e 100644 --- a/src/transport/test_plugin_transport_data_http.conf +++ b/src/transport/test_plugin_transport_data_http.conf @@ -7,9 +7,12 @@ WEAKRANDOM = YES [transport-http] PORT = 12389 -DEBUG = YES +DEBUG = NO BINDTO = 127.0.0.1 +[transport] +PREFIX = valgrind --leak-check=full +DEBUG = NO [statistics] ACCEPT_FROM6 = ::1; diff --git a/src/transport/test_plugin_transport_http.c b/src/transport/test_plugin_transport_http.c index db24628f6..24689f81a 100644 --- a/src/transport/test_plugin_transport_http.c +++ b/src/transport/test_plugin_transport_http.c @@ -888,7 +888,7 @@ plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, struct Session *session) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Session ended: `%s' %X\n", GNUNET_i2s(peer), session); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Pluging tells me: session %X to peer `%s' ended\n", session, GNUNET_i2s(peer)); } -- 2.25.1