{
#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
{
#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
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;
#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
*/
int max_connections;
+ /**
+ * Number of outbound sessions
+ */
+ unsigned int outbound_sessions;
+
+ /**
+ * Number of inbound sessions
+ */
+ unsigned int inbound_sessions;
+
/**
* Plugin HTTPS SSL/TLS options
* ----------------------------
void *transmit_cont_cls;
};
+int
+exist_session (struct Plugin *plugin, struct Session *s);
+
void
delete_session (struct Session *s);
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)
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)
}
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)
{
/* 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)
{
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 */
+ /* find duplicate session */
t = plugin->head;
-
while (t != NULL)
{
if ((t->inbound) &&
"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))
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;
}
struct Session *s = NULL;
struct Session *t = NULL;
struct Plugin *plugin = NULL;
-
+GNUNET_break (0);
if (sc == NULL)
return;
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);
}
}