From 4a52abfc7a735fa1d47eee4cfd9ddd4e953d9d04 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 16 Mar 2010 14:57:39 +0000 Subject: [PATCH] stuff --- src/core/gnunet-service-core.c | 34 +++++++++++++++++++++--- src/include/gnunet_transport_service.h | 6 ++--- src/transport/gnunet-service-transport.c | 10 ++++--- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index bd7703db7..7c11feaff 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -1104,7 +1104,7 @@ free_neighbour (struct Neighbour *n) if (n->keep_alive_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel (sched, n->keep_alive_task); if (n->status == PEER_STATE_KEY_CONFIRMED) - GNUNET_STATISTICS_update (stats, gettext_noop ("# peers connected"), -1, GNUNET_NO); + GNUNET_STATISTICS_update (stats, gettext_noop ("# established sessions"), -1, GNUNET_NO); GNUNET_free_non_null (n->public_key); GNUNET_free_non_null (n->pending_ping); GNUNET_free_non_null (n->pending_pong); @@ -1319,7 +1319,9 @@ notify_encrypted_transmit_ready (void *cls, size_t size, void *buf) char *cbuf; n->th = NULL; - GNUNET_assert (NULL != (m = n->encrypted_head)); + m = n->encrypted_head; + if (m == NULL) + return 0; GNUNET_CONTAINER_DLL_remove (n->encrypted_head, n->encrypted_tail, m); @@ -2412,7 +2414,23 @@ send_key (struct Neighbour *n) #endif return; /* already in progress */ } - + if (! n->is_connected) + { + if (NULL == n->th) + { + GNUNET_STATISTICS_update (stats, + gettext_noop ("# Asking transport to connect (for SETKEY)"), + 1, + GNUNET_NO); + n->th = GNUNET_TRANSPORT_notify_transmit_ready (transport, + &n->peer, + sizeof (struct SetKeyMessage) + sizeof (struct PingMessage), + GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, + ¬ify_encrypted_transmit_ready, + n); + } + return; + } #if DEBUG_CORE GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to perform key exchange with `%4s'.\n", @@ -3403,7 +3421,7 @@ handle_transport_receive (void *cls, n->last_activity = now; if (!up) { - GNUNET_STATISTICS_update (stats, gettext_noop ("# peers connected"), 1, GNUNET_NO); + GNUNET_STATISTICS_update (stats, gettext_noop ("# established sessions"), 1, GNUNET_NO); n->time_established = now; } if (n->keep_alive_task != GNUNET_SCHEDULER_NO_TASK) @@ -3527,6 +3545,10 @@ handle_transport_notify_connect (void *cls, { n = create_neighbour (peer); } + GNUNET_STATISTICS_update (stats, + gettext_noop ("# peers connected"), + 1, + GNUNET_NO); n->is_connected = GNUNET_YES; n->last_latency = latency; n->last_distance = distance; @@ -3587,6 +3609,10 @@ handle_transport_notify_disconnect (void *cls, cnm.peer = *peer; send_to_all_clients (&cnm.header, GNUNET_YES, GNUNET_CORE_OPTION_SEND_DISCONNECT); n->is_connected = GNUNET_NO; + GNUNET_STATISTICS_update (stats, + gettext_noop ("# peers connected"), + -1, + GNUNET_NO); } diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 47d4334bb..711ebb599 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h @@ -179,9 +179,9 @@ struct GNUNET_TRANSPORT_TransmitHandle; /** * Check if we could queue a message of the given size for - * transmission. The transport service will take both its - * internal buffers and bandwidth limits imposed by the - * other peer into consideration when answering this query. + * transmission. The transport service will take both its internal + * buffers and bandwidth limits imposed by the other peer into + * consideration when answering this query. * * @param handle connection to transport service * @param target who should receive the message diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 74e194d30..70fa4e92c 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -1066,7 +1066,11 @@ transmit_send_continuation (void *cls, { struct MessageQueue *mq = cls; struct NeighbourList *n; - + + GNUNET_STATISTICS_update (stats, + gettext_noop ("# bytes pending with plugins"), + -mq->message_buf_size, + GNUNET_NO); if (result == GNUNET_OK) { GNUNET_STATISTICS_update (stats, @@ -1303,7 +1307,7 @@ try_transmission_to_peer (struct NeighbourList *neighbour) -mq->message_buf_size, GNUNET_NO); GNUNET_STATISTICS_update (stats, - gettext_noop ("# bytes transmitted to other peers"), + gettext_noop ("# bytes pending with plugins"), mq->message_buf_size, GNUNET_NO); rl->plugin->api->send (rl->plugin->api->cls, @@ -2583,7 +2587,7 @@ check_hello_validated (void *cls, else { GNUNET_STATISTICS_update (stats, - gettext_noop ("# no existing neighbour record while validating HELLO"), + gettext_noop ("# no existing neighbour record (validating HELLO)"), 1, GNUNET_NO); } -- 2.25.1