gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r21201 - gnunet/src/transport
Date: Fri, 27 Apr 2012 15:14:57 +0200

Author: wachs
Date: 2012-04-27 15:14:57 +0200 (Fri, 27 Apr 2012)
New Revision: 21201

Modified:
   gnunet/src/transport/plugin_transport_http.c
   gnunet/src/transport/plugin_transport_http.h
   gnunet/src/transport/plugin_transport_http_client.c
   gnunet/src/transport/plugin_transport_http_server.c
Log:
-stat counter for http


Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c        2012-04-27 12:35:11 UTC 
(rev 21200)
+++ gnunet/src/transport/plugin_transport_http.c        2012-04-27 13:14:57 UTC 
(rev 21201)
@@ -772,7 +772,7 @@
   {
 #if DEBUG_HTTP
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Using outbound client session %p to send to 
`%session'\n", session,
+                     "Using outbound client session %p to send to `%s'\n", 
session,
                      GNUNET_i2s (&session->target));
 #endif
 
@@ -783,7 +783,7 @@
   {
 #if DEBUG_HTTP
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                     "Using inbound server %p session to send to 
`%session'\n", session,
+                     "Using inbound server %p session to send to `%s'\n", 
session,
                      GNUNET_i2s (&session->target));
 #endif
 
@@ -1477,6 +1477,8 @@
 
   plugin = GNUNET_malloc (sizeof (struct Plugin));
   plugin->env = env;
+  plugin->outbound_sessions = 0;
+  plugin->inbound_sessions = 0;
   api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
   api->cls = plugin;
   api->disconnect = &http_plugin_disconnect;

Modified: gnunet/src/transport/plugin_transport_http.h
===================================================================
--- gnunet/src/transport/plugin_transport_http.h        2012-04-27 12:35:11 UTC 
(rev 21200)
+++ gnunet/src/transport/plugin_transport_http.h        2012-04-27 13:14:57 UTC 
(rev 21201)
@@ -45,7 +45,7 @@
 #define DEBUG_HTTP GNUNET_EXTRA_LOGGING
 #define VERBOSE_SERVER GNUNET_EXTRA_LOGGING
 #define VERBOSE_CLIENT GNUNET_EXTRA_LOGGING
-#define VERBOSE_CURL GNUNET_EXTRA_LOGGING
+#define VERBOSE_CURL GNUNET_NO
 
 #if BUILD_HTTPS
 #define LIBGNUNET_PLUGIN_TRANSPORT_INIT libgnunet_plugin_transport_https_init
@@ -160,6 +160,16 @@
   int max_connections;
 
   /**
+   * Number of outbound sessions
+   */
+  unsigned int outbound_sessions;
+
+  /**
+   * Number of inbound sessions
+   */
+  unsigned int inbound_sessions;
+
+  /**
    * Plugin HTTPS SSL/TLS options
    * ----------------------------
    */
@@ -453,6 +463,9 @@
   void *transmit_cont_cls;
 };
 
+int
+exist_session (struct Plugin *plugin, struct Session *s);
+
 void
 delete_session (struct Session *s);
 

Modified: gnunet/src/transport/plugin_transport_http_client.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_client.c 2012-04-27 12:35:11 UTC 
(rev 21200)
+++ gnunet/src/transport/plugin_transport_http_client.c 2012-04-27 13:14:57 UTC 
(rev 21201)
@@ -264,11 +264,9 @@
 
   if (s->client_put != NULL)
   {
-#if DEBUG_HTTP
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
                      "Client: %X Deleting outbound PUT session to peer `%s'\n",
                      s->client_put, GNUNET_i2s (&s->target));
-#endif
 
     mret = curl_multi_remove_handle (plugin->client_mh, s->client_put);
     if (mret != CURLM_OK)
@@ -290,11 +288,9 @@
 
   if (s->client_get != NULL)
   {
-#if DEBUG_HTTP
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
                      "Client: %X Deleting outbound GET session to peer `%s'\n",
                      s->client_get, GNUNET_i2s (&s->target));
-#endif
 
     mret = curl_multi_remove_handle (plugin->client_mh, s->client_get);
     if (mret != CURLM_OK)
@@ -319,6 +315,14 @@
   }
 
   plugin->cur_connections -= 2;
+
+  GNUNET_assert (plugin->outbound_sessions > 0);
+  plugin->outbound_sessions --;
+  GNUNET_STATISTICS_set (plugin->env->stats,
+      "# HTTP outbound sessions",
+      plugin->outbound_sessions,
+      GNUNET_NO);
+
   /* Re-schedule since handles have changed */
   if (plugin->client_perform_task != GNUNET_SCHEDULER_NO_TASK)
   {
@@ -634,6 +638,12 @@
   /* Perform connect */
   plugin->cur_connections += 2;
 
+  plugin->outbound_sessions ++;
+  GNUNET_STATISTICS_set (plugin->env->stats,
+      "# HTTP outbound sessions",
+      plugin->outbound_sessions,
+      GNUNET_NO);
+
   /* Re-schedule since handles have changed */
   if (plugin->client_perform_task != GNUNET_SCHEDULER_NO_TASK)
   {

Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2012-04-27 12:35:11 UTC 
(rev 21200)
+++ gnunet/src/transport/plugin_transport_http_server.c 2012-04-27 13:14:57 UTC 
(rev 21201)
@@ -419,12 +419,12 @@
 
   plugin->cur_connections++;
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                   "Server: New inbound connection from %s with tag %u\n",
+                   "Server: New %s connection from %s with tag %u\n",
+                   method,
                    GNUNET_i2s (&target), tag);
+
   /* find duplicate session */
-
   t = plugin->head;
-
   while (t != NULL)
   {
     if ((t->inbound) &&
@@ -480,6 +480,13 @@
                      "Server: Found matching semi-session, merging session for 
peer `%s'\n",
                      GNUNET_i2s (&target));
 
+    GNUNET_break (0);
+    plugin->inbound_sessions ++;
+    GNUNET_STATISTICS_set (plugin->env->stats,
+        "# HTTP inbound sessions",
+        plugin->inbound_sessions,
+        GNUNET_NO);
+
     goto found;
   }
   if ((direction == _RECEIVE) && (t->server_recv != NULL))
@@ -498,6 +505,14 @@
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
                      "Server: Found matching semi-session, merging session for 
peer `%s'\n",
                      GNUNET_i2s (&target));
+
+    GNUNET_break (0);
+    plugin->inbound_sessions ++;
+    GNUNET_STATISTICS_set (plugin->env->stats,
+        "# HTTP inbound sessions",
+        plugin->inbound_sessions,
+        GNUNET_NO);
+
     goto found;
   }
 
@@ -741,7 +756,7 @@
   struct Session *s = NULL;
   struct Session *t = NULL;
   struct Plugin *plugin = NULL;
-
+GNUNET_break (0);
   if (sc == NULL)
     return;
 
@@ -829,6 +844,12 @@
       s->msg_tk = NULL;
     }
 
+    GNUNET_assert (plugin->inbound_sessions > 0);
+    plugin->inbound_sessions --;
+    GNUNET_STATISTICS_set (plugin->env->stats,
+        "# HTTP inbound sessions",
+        plugin->inbound_sessions, GNUNET_NO);
+
     notify_session_end (s->plugin, &s->target, s);
   }
 }




reply via email to

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