gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21190 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r21190 - gnunet/src/transport
Date: Fri, 27 Apr 2012 11:58:39 +0200

Author: wachs
Date: 2012-04-27 11:58:39 +0200 (Fri, 27 Apr 2012)
New Revision: 21190

Modified:
   gnunet/src/transport/plugin_transport_unix.c
Log:
- some stats


Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c        2012-04-27 08:26:36 UTC 
(rev 21189)
+++ gnunet/src/transport/plugin_transport_unix.c        2012-04-27 09:58:39 UTC 
(rev 21190)
@@ -242,6 +242,8 @@
    * ATS network
    */
   struct GNUNET_ATS_Information ats_network;
+
+  unsigned int bytes_in_queue;
 };
 
 
@@ -632,6 +634,7 @@
           sizeof (struct GNUNET_PeerIdentity));
   memcpy (&message[1], msgbuf, msgbuf_size);
 
+
   wrapper = GNUNET_malloc (sizeof (struct UNIXMessageWrapper));
   wrapper->msg = message;
   wrapper->msgsize = ssize;
@@ -643,6 +646,10 @@
 
   GNUNET_CONTAINER_DLL_insert(plugin->msg_head, plugin->msg_tail, wrapper);
 
+  plugin->bytes_in_queue += ssize;
+  GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue",
+      plugin->bytes_in_queue, GNUNET_NO);
+
 #if DEBUG_UNIX
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %d bytes to `%s'\n", ssize,
               (char *) session->addr);
@@ -788,6 +795,12 @@
   if (sent > 0)
   {
     GNUNET_CONTAINER_DLL_remove(plugin->msg_head, plugin->msg_tail, msgw);
+
+    GNUNET_assert (plugin->bytes_in_queue > msgw->msgsize);
+    plugin->bytes_in_queue -= msgw->msgsize;
+    GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue",
+        plugin->bytes_in_queue, GNUNET_NO);
+
     GNUNET_free (msgw->msg);
     GNUNET_free (msgw);
     return;
@@ -797,6 +810,12 @@
   if (sent == -1)
   {
     GNUNET_CONTAINER_DLL_remove(plugin->msg_head, plugin->msg_tail, msgw);
+
+    GNUNET_assert (plugin->bytes_in_queue > msgw->msgsize);
+    plugin->bytes_in_queue -= msgw->msgsize;
+    GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue",
+        plugin->bytes_in_queue, GNUNET_NO);
+
     GNUNET_free (msgw->msg);
     GNUNET_free (msgw);
     return;
@@ -1079,7 +1098,7 @@
     api->cls = NULL;
     api->address_pretty_printer = &unix_plugin_address_pretty_printer;
     api->address_to_string = &unix_address_to_string;
-    api->string_to_address = NULL; // FIXME!
+    api->string_to_address = &unix_string_to_address;
     return api;
   }
   GNUNET_assert( NULL != env->stats);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]