aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-03-16 14:11:54 +0000
committerChristian Grothoff <christian@grothoff.org>2010-03-16 14:11:54 +0000
commit1f5249e010b9d850e8aa6b6b745e55902051ac2e (patch)
tree463b1817b38103466413b759ef6c5269f6e8766c /src/transport/plugin_transport_tcp.c
parente854e44db02c14e84e5d03a65177138d2c206596 (diff)
downloadgnunet-1f5249e010b9d850e8aa6b6b745e55902051ac2e.tar.gz
gnunet-1f5249e010b9d850e8aa6b6b745e55902051ac2e.zip
stats
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index a08d98625..e1bb0c7e9 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -308,6 +308,10 @@ create_session (struct Plugin *plugin,
308 welcome.clientIdentity = *plugin->env->my_identity; 308 welcome.clientIdentity = *plugin->env->my_identity;
309 memcpy (&pm[1], &welcome, sizeof (welcome)); 309 memcpy (&pm[1], &welcome, sizeof (welcome));
310 pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS; 310 pm->timeout = GNUNET_TIME_UNIT_FOREVER_ABS;
311 GNUNET_STATISTICS_update (plugin->env->stats,
312 gettext_noop ("# bytes currently in TCP buffers"),
313 pm->message_size,
314 GNUNET_NO);
311 GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head, 315 GNUNET_CONTAINER_DLL_insert (ret->pending_messages_head,
312 ret->pending_messages_tail, 316 ret->pending_messages_tail,
313 pm); 317 pm);
@@ -370,6 +374,10 @@ do_transmit (void *cls, size_t size, void *buf)
370 pm->message_size, 374 pm->message_size,
371 GNUNET_i2s (&session->target)); 375 GNUNET_i2s (&session->target));
372#endif 376#endif
377 GNUNET_STATISTICS_update (plugin->env->stats,
378 gettext_noop ("# bytes currently in TCP buffers"),
379 -pm->message_size,
380 GNUNET_NO);
373 GNUNET_STATISTICS_update (session->plugin->env->stats, 381 GNUNET_STATISTICS_update (session->plugin->env->stats,
374 gettext_noop ("# bytes discarded by TCP (timeout)"), 382 gettext_noop ("# bytes discarded by TCP (timeout)"),
375 pm->message_size, 383 pm->message_size,
@@ -394,6 +402,10 @@ do_transmit (void *cls, size_t size, void *buf)
394 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, 402 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
395 session->pending_messages_tail, 403 session->pending_messages_tail,
396 pm); 404 pm);
405 GNUNET_STATISTICS_update (plugin->env->stats,
406 gettext_noop ("# bytes currently in TCP buffers"),
407 -pm->message_size,
408 GNUNET_NO);
397 if (pm->transmit_cont != NULL) 409 if (pm->transmit_cont != NULL)
398 pm->transmit_cont (pm->transmit_cont_cls, 410 pm->transmit_cont (pm->transmit_cont_cls,
399 &session->target, GNUNET_OK); 411 &session->target, GNUNET_OK);
@@ -490,6 +502,14 @@ disconnect_session (struct Session *session)
490 "Could not deliver message to `%4s', notifying.\n", 502 "Could not deliver message to `%4s', notifying.\n",
491 GNUNET_i2s (&session->target)); 503 GNUNET_i2s (&session->target));
492#endif 504#endif
505 GNUNET_STATISTICS_update (plugin->env->stats,
506 gettext_noop ("# bytes currently in TCP buffers"),
507 -pm->message_size,
508 GNUNET_NO);
509 GNUNET_STATISTICS_update (plugin->env->stats,
510 gettext_noop ("# bytes discarded by TCP (disconnect)"),
511 pm->message_size,
512 GNUNET_NO);
493 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head, 513 GNUNET_CONTAINER_DLL_remove (session->pending_messages_head,
494 session->pending_messages_tail, 514 session->pending_messages_tail,
495 pm); 515 pm);
@@ -673,6 +693,10 @@ tcp_plugin_send (void *cls,
673 GNUNET_assert (session != NULL); 693 GNUNET_assert (session != NULL);
674 GNUNET_assert (session->client != NULL); 694 GNUNET_assert (session->client != NULL);
675 695
696 GNUNET_STATISTICS_update (plugin->env->stats,
697 gettext_noop ("# bytes currently in TCP buffers"),
698 msgbuf_size,
699 GNUNET_NO);
676 /* create new message entry */ 700 /* create new message entry */
677 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size); 701 pm = GNUNET_malloc (sizeof (struct PendingMessage) + msgbuf_size);
678 pm->msg = (const char*) &pm[1]; 702 pm->msg = (const char*) &pm[1];