diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-03-13 09:11:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-03-13 09:11:17 +0000 |
commit | 7ce4e43560aa2674a35a7a4fd94d512410139df6 (patch) | |
tree | f391e005330dc22ee6fe55d4877638989ebb08c0 /src/transport/plugin_transport_tcp.c | |
parent | 4747017ec10a6d6a202be6e931c10da001571aad (diff) | |
download | gnunet-7ce4e43560aa2674a35a7a4fd94d512410139df6.tar.gz gnunet-7ce4e43560aa2674a35a7a4fd94d512410139df6.zip |
add stats
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 9b6200b80..16de7b7e4 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -310,6 +310,10 @@ create_session (struct Plugin *plugin, | |||
310 | GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head, | 310 | GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head, |
311 | ret->pending_messages_tail, | 311 | ret->pending_messages_tail, |
312 | pm); | 312 | pm); |
313 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
314 | gettext_noop ("# TCP sessions active"), | ||
315 | 1, | ||
316 | GNUNET_NO); | ||
313 | return ret; | 317 | return ret; |
314 | } | 318 | } |
315 | 319 | ||
@@ -396,6 +400,10 @@ do_transmit (void *cls, size_t size, void *buf) | |||
396 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 400 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
397 | "tcp", "Transmitting %u bytes\n", ret); | 401 | "tcp", "Transmitting %u bytes\n", ret); |
398 | #endif | 402 | #endif |
403 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
404 | gettext_noop ("# bytes transmitted via TCP"), | ||
405 | ret, | ||
406 | GNUNET_NO); | ||
399 | return ret; | 407 | return ret; |
400 | } | 408 | } |
401 | 409 | ||
@@ -515,6 +523,10 @@ disconnect_session (struct Session *session) | |||
515 | GNUNET_SERVER_client_drop (session->client); | 523 | GNUNET_SERVER_client_drop (session->client); |
516 | session->client = NULL; | 524 | session->client = NULL; |
517 | } | 525 | } |
526 | GNUNET_STATISTICS_update (session->plugin->env->stats, | ||
527 | gettext_noop ("# TCP sessions active"), | ||
528 | -1, | ||
529 | GNUNET_NO); | ||
518 | GNUNET_free_non_null (session->connect_addr); | 530 | GNUNET_free_non_null (session->connect_addr); |
519 | GNUNET_free (session); | 531 | GNUNET_free (session); |
520 | } | 532 | } |
@@ -903,6 +915,10 @@ handle_tcp_welcome (void *cls, | |||
903 | "WELCOME", | 915 | "WELCOME", |
904 | GNUNET_i2s (&wm->clientIdentity), client); | 916 | GNUNET_i2s (&wm->clientIdentity), client); |
905 | #endif | 917 | #endif |
918 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
919 | gettext_noop ("# TCP WELCOME messages received"), | ||
920 | 1, | ||
921 | GNUNET_NO); | ||
906 | session = find_session_by_client (plugin, client); | 922 | session = find_session_by_client (plugin, client); |
907 | if (session == NULL) | 923 | if (session == NULL) |
908 | { | 924 | { |
@@ -1010,6 +1026,10 @@ handle_tcp_data (void *cls, | |||
1010 | (unsigned int) ntohs (message->type), | 1026 | (unsigned int) ntohs (message->type), |
1011 | GNUNET_i2s (&session->target)); | 1027 | GNUNET_i2s (&session->target)); |
1012 | #endif | 1028 | #endif |
1029 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1030 | gettext_noop ("# bytes received via TCP"), | ||
1031 | ntohs (message->size), | ||
1032 | GNUNET_NO); | ||
1013 | delay = plugin->env->receive (plugin->env->cls, &session->target, message, 1, | 1033 | delay = plugin->env->receive (plugin->env->cls, &session->target, message, 1, |
1014 | session->connect_addr, | 1034 | session->connect_addr, |
1015 | session->connect_alen); | 1035 | session->connect_alen); |