aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_unix.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-04-27 09:58:39 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-04-27 09:58:39 +0000
commit26324c4843b74ec54959f51b42425d9362412bf8 (patch)
tree96109389568b408cf4cd24aa83bafb9fdcb5d780 /src/transport/plugin_transport_unix.c
parent2162a3697e647b74984520821b35df624cca1728 (diff)
downloadgnunet-26324c4843b74ec54959f51b42425d9362412bf8.tar.gz
gnunet-26324c4843b74ec54959f51b42425d9362412bf8.zip
- some stats
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r--src/transport/plugin_transport_unix.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c
index c01304b3f..46dee9ce3 100644
--- a/src/transport/plugin_transport_unix.c
+++ b/src/transport/plugin_transport_unix.c
@@ -242,6 +242,8 @@ struct Plugin
242 * ATS network 242 * ATS network
243 */ 243 */
244 struct GNUNET_ATS_Information ats_network; 244 struct GNUNET_ATS_Information ats_network;
245
246 unsigned int bytes_in_queue;
245}; 247};
246 248
247 249
@@ -632,6 +634,7 @@ unix_plugin_send (void *cls,
632 sizeof (struct GNUNET_PeerIdentity)); 634 sizeof (struct GNUNET_PeerIdentity));
633 memcpy (&message[1], msgbuf, msgbuf_size); 635 memcpy (&message[1], msgbuf, msgbuf_size);
634 636
637
635 wrapper = GNUNET_malloc (sizeof (struct UNIXMessageWrapper)); 638 wrapper = GNUNET_malloc (sizeof (struct UNIXMessageWrapper));
636 wrapper->msg = message; 639 wrapper->msg = message;
637 wrapper->msgsize = ssize; 640 wrapper->msgsize = ssize;
@@ -643,6 +646,10 @@ unix_plugin_send (void *cls,
643 646
644 GNUNET_CONTAINER_DLL_insert(plugin->msg_head, plugin->msg_tail, wrapper); 647 GNUNET_CONTAINER_DLL_insert(plugin->msg_head, plugin->msg_tail, wrapper);
645 648
649 plugin->bytes_in_queue += ssize;
650 GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue",
651 plugin->bytes_in_queue, GNUNET_NO);
652
646#if DEBUG_UNIX 653#if DEBUG_UNIX
647 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %d bytes to `%s'\n", ssize, 654 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %d bytes to `%s'\n", ssize,
648 (char *) session->addr); 655 (char *) session->addr);
@@ -788,6 +795,12 @@ unix_plugin_select_write (struct Plugin * plugin)
788 if (sent > 0) 795 if (sent > 0)
789 { 796 {
790 GNUNET_CONTAINER_DLL_remove(plugin->msg_head, plugin->msg_tail, msgw); 797 GNUNET_CONTAINER_DLL_remove(plugin->msg_head, plugin->msg_tail, msgw);
798
799 GNUNET_assert (plugin->bytes_in_queue > msgw->msgsize);
800 plugin->bytes_in_queue -= msgw->msgsize;
801 GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue",
802 plugin->bytes_in_queue, GNUNET_NO);
803
791 GNUNET_free (msgw->msg); 804 GNUNET_free (msgw->msg);
792 GNUNET_free (msgw); 805 GNUNET_free (msgw);
793 return; 806 return;
@@ -797,6 +810,12 @@ unix_plugin_select_write (struct Plugin * plugin)
797 if (sent == -1) 810 if (sent == -1)
798 { 811 {
799 GNUNET_CONTAINER_DLL_remove(plugin->msg_head, plugin->msg_tail, msgw); 812 GNUNET_CONTAINER_DLL_remove(plugin->msg_head, plugin->msg_tail, msgw);
813
814 GNUNET_assert (plugin->bytes_in_queue > msgw->msgsize);
815 plugin->bytes_in_queue -= msgw->msgsize;
816 GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue",
817 plugin->bytes_in_queue, GNUNET_NO);
818
800 GNUNET_free (msgw->msg); 819 GNUNET_free (msgw->msg);
801 GNUNET_free (msgw); 820 GNUNET_free (msgw);
802 return; 821 return;
@@ -1079,7 +1098,7 @@ libgnunet_plugin_transport_unix_init (void *cls)
1079 api->cls = NULL; 1098 api->cls = NULL;
1080 api->address_pretty_printer = &unix_plugin_address_pretty_printer; 1099 api->address_pretty_printer = &unix_plugin_address_pretty_printer;
1081 api->address_to_string = &unix_address_to_string; 1100 api->address_to_string = &unix_address_to_string;
1082 api->string_to_address = NULL; // FIXME! 1101 api->string_to_address = &unix_string_to_address;
1083 return api; 1102 return api;
1084 } 1103 }
1085 GNUNET_assert( NULL != env->stats); 1104 GNUNET_assert( NULL != env->stats);