Check that you are not present in trail twice
[oweals/gnunet.git] / src / transport / plugin_transport_http_client.c
index c4c8b19335bf5296371aad44658188ac4ef2b0df..615639a6e077402e211fe44ede0cbd7bb8a55c1f 100644 (file)
@@ -471,6 +471,8 @@ client_delete_session (struct Session *s)
                                      s->put.easyhandle);
     GNUNET_break (CURLM_OK == mret);
     curl_easy_cleanup (s->put.easyhandle);
+    GNUNET_assert (plugin->cur_requests > 0);
+    plugin->cur_requests--;
     s->put.easyhandle = NULL;
   }
   if (NULL != s->get.easyhandle)
@@ -488,6 +490,7 @@ client_delete_session (struct Session *s)
     plugin->cur_requests--;
     s->get.easyhandle = NULL;
   }
+
   GNUNET_STATISTICS_set (plugin->env->stats,
                          HTTP_STAT_STR_CONNECTIONS,
                          plugin->cur_requests,
@@ -1318,7 +1321,6 @@ client_run (void *cls,
       GNUNET_break (CURLE_OK == curl_easy_getinfo (easy_h,
           CURLINFO_RESPONSE_CODE, &http_statuscode));
 
-
       if (easy_h == s->put.easyhandle)
         put_request = GNUNET_YES;
       else
@@ -1414,6 +1416,11 @@ client_run (void *cls,
       }
       else
         GNUNET_break (0); /* Must not happen */
+
+      GNUNET_STATISTICS_set (plugin->env->stats,
+                             HTTP_STAT_STR_CONNECTIONS,
+                             plugin->cur_requests,
+                             GNUNET_NO);
     }
   }
   while (mret == CURLM_CALL_MULTI_PERFORM);
@@ -2070,18 +2077,12 @@ client_configure_plugin (struct HTTP_Client_Plugin *plugin)
 
 
 /**
- * Function called by the pretty printer for the resolved address for
- * each human-readable address obtained.  The callback can be called
- * several times. The last invocation must be with a @a address of
- * NULL and a @a res of #GNUNET_OK.  Thus, to indicate conversion
- * errors, the callback might be called first with @a address NULL and
- * @a res being #GNUNET_SYSERR.  In that case, there must still be a
- * subsequent call later with @a address NULL and @a res #GNUNET_OK.
+ * Function to convert an address to a human-readable string.
  *
  * @param cls closure
- * @param address one of the names for the host, NULL on last callback
- * @param res #GNUNET_OK if conversion was successful, #GNUNET_SYSERR on failure,
- *      #GNUNET_OK on last callback
+ * @param addr address to convert
+ * @param addrlen address length
+ * @return res string if conversion was successful, NULL otherwise
  */
 static const char *
 http_client_plugin_address_to_string (void *cls,
@@ -2119,7 +2120,7 @@ http_client_plugin_update_session_timeout (void *cls,
  *
  * @param cls closure
  * @param peer which peer was the session for
- * @param session which session is being updated
+ * @param s which session is being updated
  * @param delay new delay to use for receiving
  */
 static void