From 88ae0b0fd1508bb729592ef203b2e7e88980631c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 10 Feb 2019 23:02:06 +0100 Subject: [PATCH] add some logging --- src/ats/gnunet-service-ats-new.c | 23 +++++++++++++++++++++++ src/ats/test_ats2_lib.c | 13 ++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/src/ats/gnunet-service-ats-new.c b/src/ats/gnunet-service-ats-new.c index dd65d54a2..a1666d8d3 100644 --- a/src/ats/gnunet-service-ats-new.c +++ b/src/ats/gnunet-service-ats-new.c @@ -213,6 +213,10 @@ suggest_cb (void *cls, // FIXME: stats! return; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Suggesting address `%s' of peer `%s'\n", + address, + GNUNET_i2s (pid)); env = GNUNET_MQ_msg_extra (as, slen, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION); @@ -253,6 +257,12 @@ allocate_cb (void *cls, losses of sessions (possibly of previous transport), ignore! */ return; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Allocating %u/%u bytes for %p of peer `%s'\n", + ntohl (bw_in.value__), + ntohl (bw_out.value__), + session, + GNUNET_i2s (peer)); env = GNUNET_MQ_msg (sam, GNUNET_MESSAGE_TYPE_ATS_SESSION_ALLOCATION); sam->session_id = session->session_id; @@ -307,6 +317,11 @@ handle_suggest (void *cls, GNUNET_SERVICE_client_drop (c->client); return; } + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Client suggested we talk to %s with preference %d at rate %u\n", + GNUNET_i2s (&msg->peer), + (int) ntohl (msg->pk), + (int) ntohl (msg->bw.value__)); cp = GNUNET_new (struct ClientPreference); cp->client = c; cp->pref.peer = msg->peer; @@ -464,6 +479,10 @@ handle_session_add (void *cls, &session->data, address); GNUNET_assert (NULL != session->sh); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Transport has new session %p to %s\n", + session, + GNUNET_i2s (&message->peer)); GNUNET_SERVICE_client_continue (c->client); } @@ -540,6 +559,10 @@ handle_session_del (void *cls, GNUNET_CONTAINER_multihashmap32_remove (c->details.transport.sessions, session->session_id, session)); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Transport lost session %p to %s\n", + session, + GNUNET_i2s (&session->data.peer)); GNUNET_free (session); GNUNET_SERVICE_client_continue (c->client); } diff --git a/src/ats/test_ats2_lib.c b/src/ats/test_ats2_lib.c index 990eb0670..5c51e5322 100644 --- a/src/ats/test_ats2_lib.c +++ b/src/ats/test_ats2_lib.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ @@ -31,13 +31,11 @@ */ static int ret; - /** * @brief The time available until the test shuts down */ static struct GNUNET_TIME_Relative timeout; - /** * @brief ATS Application Handle * @@ -64,6 +62,7 @@ static struct GNUNET_PeerIdentity other_peer; */ static struct GNUNET_ATS_SessionRecord *sr; + /** * @brief Called whenever allocation changed * @@ -74,7 +73,7 @@ static struct GNUNET_ATS_SessionRecord *sr; * @param bandwidth_out * @param bandwidth_in * - * @return + * @return */ static void allocation_cb (void *cls, @@ -116,9 +115,9 @@ init_both (const struct GNUNET_CONFIGURATION_Handle *cfg) ah = GNUNET_ATS_application_init (cfg); GNUNET_assert (NULL != ah); th = GNUNET_ATS_transport_init (cfg, - allocation_cb, + &allocation_cb, NULL, - suggestion_cb, + &suggestion_cb, NULL); GNUNET_assert (NULL != ah); } @@ -227,7 +226,7 @@ run (void *cls, * @param argc * @param argv[] * - * @return + * @return */ int main (int argc, -- 2.25.1