- if (msg->msg == CURLMSG_DONE)
- {
-#if DEBUG_HTTP
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
- "Client: %X connection to '%s' %s ended\n", msg->easy_handle, GNUNET_i2s(&s->target), GNUNET_a2s (s->addr, s->addrlen));
-#endif
- client_disconnect(s);
- //GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,"Notifying about ended session to peer `%s' `%s'\n", GNUNET_i2s (&s->target), http_plugin_address_to_string (plugin, s->addr, s->addrlen));
- notify_session_end (plugin, &s->target, s);
- }
+ while ((msg = curl_multi_info_read (plugin->client_mh, &msgs_left)))
+ {
+ CURL *easy_h = msg->easy_handle;
+ struct Session *s = NULL;
+ char *d = (char *) s;
+
+
+ //GNUNET_assert (easy_h != NULL);
+ if (easy_h == NULL)
+ {
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Client: connection to ended with reason %i: `%s', %i handles running\n",
+ msg->data.result,
+ curl_easy_strerror (msg->data.result), running);
+ continue;
+ }
+
+ GNUNET_assert (CURLE_OK ==
+ curl_easy_getinfo (easy_h, CURLINFO_PRIVATE, &d));
+ s = (struct Session *) d;
+ GNUNET_assert (s != NULL);
+
+ if (msg->msg == CURLMSG_DONE)
+ {
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+ "Client: %X connection to '%s' %s ended with reason %i: `%s'\n",
+ msg->easy_handle, GNUNET_i2s (&s->target),
+ http_plugin_address_to_string (NULL, s->addr,
+ s->addrlen),
+ msg->data.result,
+ curl_easy_strerror (msg->data.result));
+
+ client_disconnect (s);
+ //GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,"Notifying about ended session to peer `%s' `%s'\n", GNUNET_i2s (&s->target), http_plugin_address_to_string (plugin, s->addr, s->addrlen));
+ notify_session_end (plugin, &s->target, s);
+ }