From c2ed00daf302674f4cf9ffcbdfaa19d38ed57548 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 22 Jan 2017 16:49:32 +0100 Subject: [PATCH] logging fixes, notify MQM clients properly --- src/cadet/gnunet-service-cadet-new_channel.c | 30 +++++++++---------- .../gnunet-service-cadet-new_connection.c | 28 ++++++++--------- src/cadet/gnunet-service-cadet-new_peer.c | 2 ++ src/cadet/gnunet-service-cadet-new_tunnels.c | 4 +-- 4 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c index 563b1c7e7..c129022ca 100644 --- a/src/cadet/gnunet-service-cadet-new_channel.c +++ b/src/cadet/gnunet-service-cadet-new_channel.c @@ -325,7 +325,7 @@ GCCH_2s (const struct CadetChannel *ch) GNUNET_snprintf (buf, sizeof (buf), - "%s:%s ctn:%X(%X)", + "Channel %s:%s ctn:%X(%X)", GNUNET_i2s (GCP_get_id (GCT_get_destination (ch->t))), GNUNET_h2s (&ch->port), ch->ctn, @@ -439,7 +439,7 @@ send_channel_open (void *cls) ch->retry_task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending CHANNEL_OPEN message for channel %s\n", + "Sending CHANNEL_OPEN message for %s\n", GCCH_2s (ch)); options = 0; if (ch->nobuffer) @@ -702,7 +702,7 @@ GCCH_bind (struct CadetChannel *ch, uint32_t options; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Binding channel %s from tunnel %s to port %s of client %s\n", + "Binding %s from tunnel %s to port %s of client %s\n", GCCH_2s (ch), GCT_2s (ch->t), GNUNET_h2s (&ch->port), @@ -829,7 +829,7 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch) return; } LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received channel OPEN_ACK for waiting channel %s, entering READY state\n", + "Received channel OPEN_ACK for waiting %s, entering READY state\n", GCCH_2s (ch)); GNUNET_SCHEDULER_cancel (ch->retry_task); ch->retry_task = NULL; @@ -843,7 +843,7 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch) case CADET_CHANNEL_READY: /* duplicate ACK, maybe we retried the CREATE. Ignore. */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received duplicate channel OPEN_ACK for channel %s\n", + "Received duplicate channel OPEN_ACK for %s\n", GCCH_2s (ch)); GNUNET_STATISTICS_update (stats, "# duplicate CREATE_ACKs", @@ -906,7 +906,7 @@ GCCH_handle_channel_plaintext_data (struct CadetChannel *ch, payload_size = ntohs (msg->header.size) - sizeof (*msg); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Receicved %u bytes of application data on channel %s\n", + "Receicved %u bytes of application data on %s\n", (unsigned int) payload_size, GCCH_2s (ch)); env = GNUNET_MQ_msg_extra (ld, @@ -1029,7 +1029,7 @@ GCCH_handle_remote_destroy (struct CadetChannel *ch) struct GNUNET_CADET_LocalChannelDestroyMessage *tdm; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received remote channel DESTROY for channel %s\n", + "Received remote channel DESTROY for %s\n", GCCH_2s (ch)); ch->destroy = GNUNET_YES; env = GNUNET_MQ_msg (tdm, @@ -1092,7 +1092,7 @@ GCCH_check_allow_client (struct CadetChannel *ch) { /* destination did not yet ACK our CREATE! */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Channel %s not yet ready, throttling client until ACK.\n", + "%s not yet ready, throttling client until ACK.\n", GCCH_2s (ch)); return; } @@ -1100,7 +1100,7 @@ GCCH_check_allow_client (struct CadetChannel *ch) { /* Too many messages in queue. */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Message queue still too long on channel %s, throttling client until ACK.\n", + "Message queue still too long on %s, throttling client until ACK.\n", GCCH_2s (ch)); return; } @@ -1108,7 +1108,7 @@ GCCH_check_allow_client (struct CadetChannel *ch) (64 <= ntohl (ch->mid_send.mid) - ntohl (ch->head_sent->data_message.mid.mid)) ) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Gap in ACKs too big on channel %s, throttling client until ACK.\n", + "Gap in ACKs too big on %s, throttling client until ACK.\n", GCCH_2s (ch)); return; } @@ -1116,7 +1116,7 @@ GCCH_check_allow_client (struct CadetChannel *ch) LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending local ack to channel %s client\n", + "Sending local ack to %s client\n", GCCH_2s (ch)); env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK); @@ -1234,7 +1234,7 @@ GCCH_handle_local_data (struct CadetChannel *ch, ch->tail_sent, crm); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending %u bytes from local client to channel %s\n", + "Sending %u bytes from local client to %s\n", payload_size, GCCH_2s (ch)); crm->qe = GCT_send (ch->t, @@ -1266,7 +1266,7 @@ send_client_buffered_data (struct CadetChannel *ch) return; /* missing next one in-order */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Passing payload message to client on channel %s\n", + "Passing payload message to client on %s\n", GCCH_2s (ch)); /* all good, pass next message to client */ @@ -1289,7 +1289,7 @@ send_client_buffered_data (struct CadetChannel *ch) maximum of 64 bits, and 15 is getting too close for comfort.) So we should send one now. */ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sender on channel %s likely blocked on flow-control, sending ACK now.\n", + "Sender on %s likely blocked on flow-control, sending ACK now.\n", GCCH_2s (ch)); if (GNUNET_YES == ch->reliable) send_channel_data_ack (ch); @@ -1345,7 +1345,7 @@ GCCH_debug (struct CadetChannel *ch, return; } LOG2 (level, - "CHN Channel %s:%X (%p)\n", + "CHN %s:%X (%p)\n", GCT_2s (ch->t), ch->ctn, ch); diff --git a/src/cadet/gnunet-service-cadet-new_connection.c b/src/cadet/gnunet-service-cadet-new_connection.c index 9b0a2f13b..01fb100c8 100644 --- a/src/cadet/gnunet-service-cadet-new_connection.c +++ b/src/cadet/gnunet-service-cadet-new_connection.c @@ -162,7 +162,7 @@ GCC_destroy (struct CadetConnection *cc) struct GNUNET_MQ_Envelope *env = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Destroying connection %s\n", + "Destroying %s\n", GCC_2s (cc)); if (CADET_CONNECTION_SENDING_CREATE != cc->state) { @@ -210,7 +210,7 @@ void GCC_handle_connection_create_ack (struct CadetConnection *cc) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received CREATE_ACK for connection %s in state %d (%s)\n", + "Received CREATE_ACK for %s in state %d (%s)\n", GCC_2s (cc), cc->state, (GNUNET_YES == cc->mqm_ready) ? "MQM ready" : "MQM busy"); @@ -246,7 +246,7 @@ GCC_handle_kx (struct CadetConnection *cc, /* We didn't get the CREATE_ACK, but instead got payload. That's fine, clearly something is working, so pretend we got an ACK. */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Faking connection ACK for connection %s due to KX\n", + "Faking connection ACK for %s due to KX\n", GCC_2s (cc)); GCC_handle_connection_create_ack (cc); } @@ -270,7 +270,7 @@ GCC_handle_encrypted (struct CadetConnection *cc, /* We didn't get the CREATE_ACK, but instead got payload. That's fine, clearly something is working, so pretend we got an ACK. */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Faking connection ACK for connection %s due to ENCRYPTED payload\n", + "Faking connection ACK for %s due to ENCRYPTED payload\n", GCC_2s (cc)); GCC_handle_connection_create_ack (cc); } @@ -306,7 +306,7 @@ send_create (void *cls) pids[i + 1] = *GCP_get_id (GCPP_get_peer_at_offset (cc->path, i)); LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending CONNECTION_CREATE message for connection %s\n", + "Sending CONNECTION_CREATE message for %s\n", GCC_2s (cc)); cc->env = env; cc->mqm_ready = GNUNET_NO; @@ -330,7 +330,7 @@ send_create_ack (void *cls) cc->task = NULL; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Sending CONNECTION_CREATE_ACK message for connection %s\n", + "Sending CONNECTION_CREATE_ACK message for %s\n", GCC_2s (cc)); GNUNET_assert (GNUNET_YES == cc->mqm_ready); env = GNUNET_MQ_msg (ack_msg, @@ -357,7 +357,7 @@ GCC_handle_duplicate_create (struct CadetConnection *cc) if (GNUNET_YES == cc->mqm_ready) { LOG (GNUNET_ERROR_TYPE_DEBUG, - "Got duplicate CREATE for connection %s, scheduling another ACK\n", + "Got duplicate CREATE for %s, scheduling another ACK\n", GCC_2s (cc)); /* Tell tunnel that we are not ready for transmission anymore (until CREATE_ACK is done) */ @@ -375,7 +375,7 @@ GCC_handle_duplicate_create (struct CadetConnection *cc) can only be an ACK or payload, either of which would do. So actually no need to do anything. */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Got duplicate CREATE for connection %s. MQ is busy, not queueing another ACK\n", + "Got duplicate CREATE for %s. MQ is busy, not queueing another ACK\n", GCC_2s (cc)); } } @@ -401,7 +401,7 @@ manage_first_hop_mq (void *cls, { /* Connection is down, for now... */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Core MQ for connection %s went down\n", + "Core MQ for %s went down\n", GCC_2s (cc)); cc->mqm_ready = GNUNET_NO; cc->state = CADET_CONNECTION_NEW; @@ -418,7 +418,7 @@ manage_first_hop_mq (void *cls, cc->mqm_ready = GNUNET_YES; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Core MQ for connection %s became available in state %d\n", + "Core MQ for %s became available in state %d\n", GCC_2s (cc), cc->state); switch (cc->state) @@ -495,7 +495,7 @@ connection_create (struct CadetPeer *destination, cc->path = path; cc->off = off; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Creating connection %s using path %s\n", + "Creating %s using path %s\n", GCC_2s (cc), GCPP_2s (path)); GCPP_add_connection (path, @@ -646,14 +646,14 @@ GCC_2s (const struct CadetConnection *cc) { GNUNET_snprintf (buf, sizeof (buf), - "Connection(%s(Tunnel(%s)))", + "Connection %s (%s)", GNUNET_sh2s (&cc->cid.connection_of_tunnel), GCT_2s (cc->ct->t)); return buf; } GNUNET_snprintf (buf, sizeof (buf), - "Connection(%s(Tunnel(NULL)))", + "Connection %s", GNUNET_sh2s (&cc->cid.connection_of_tunnel)); return buf; } @@ -686,7 +686,7 @@ GCC_debug (struct CadetConnection *cc, return; } LOG2 (level, - "Connection %s to %s via path %s in state %d is %s\n", + "%s to %s via path %s in state %d is %s\n", GCC_2s (cc), GCP_2s (cc->destination), GCPP_2s (cc->path), diff --git a/src/cadet/gnunet-service-cadet-new_peer.c b/src/cadet/gnunet-service-cadet-new_peer.c index 1505914a1..f824caee6 100644 --- a/src/cadet/gnunet-service-cadet-new_peer.c +++ b/src/cadet/gnunet-service-cadet-new_peer.c @@ -530,6 +530,8 @@ mqm_execute (struct GCP_MessageQueueManager *mqm) mqm->env); mqm->env = NULL; cp->mqm_ready_counter--; + mqm->cb (mqm->cb_cls, + GNUNET_YES); } diff --git a/src/cadet/gnunet-service-cadet-new_tunnels.c b/src/cadet/gnunet-service-cadet-new_tunnels.c index a1a7b80fd..8923f6056 100644 --- a/src/cadet/gnunet-service-cadet-new_tunnels.c +++ b/src/cadet/gnunet-service-cadet-new_tunnels.c @@ -406,10 +406,10 @@ GCT_2s (const struct CadetTunnel *t) static char buf[64]; if (NULL == t) - return "T(NULL)"; + return "Tunnel(NULL)"; GNUNET_snprintf (buf, sizeof (buf), - "T(%s)", + "Tunnel %s", GNUNET_i2s (GCP_get_id (t->destination))); return buf; } -- 2.25.1