aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_client.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-18 09:58:39 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-18 09:58:39 +0000
commitab1bea7ea82a2ca7c98093d8c09e41ba67204164 (patch)
treecc166d1bcf626ee4cbae609f4f8e9125199b25ac /src/transport/plugin_transport_http_client.c
parent1f82d2ddd7597baca0591c3beccccd2b8a40031f (diff)
downloadgnunet-ab1bea7ea82a2ca7c98093d8c09e41ba67204164.tar.gz
gnunet-ab1bea7ea82a2ca7c98093d8c09e41ba67204164.zip
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r--src/transport/plugin_transport_http_client.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index eaf84006f..9c56daf5f 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -52,9 +52,11 @@ client_log (CURL * curl, curl_infotype type, char *data, size_t size, void *cls)
52 text[size + 1] = '\0'; 52 text[size + 1] = '\0';
53 } 53 }
54#if BUILD_HTTPS 54#if BUILD_HTTPS
55 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-https", "Client: %X - %s", cls, text); 55 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
56 "transport-https", "Client: %X - %s", cls, text);
56#else 57#else
57 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-http", "Client: %X - %s", cls, text); 58 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
59 "transport-http", "Client: %X - %s", cls, text);
58#endif 60#endif
59 } 61 }
60 return 0; 62 return 0;
@@ -150,7 +152,8 @@ client_send (struct Session *s, struct HTTP_Message *msg)
150 if ((s != NULL) && (s->client_put_paused == GNUNET_YES)) 152 if ((s != NULL) && (s->client_put_paused == GNUNET_YES))
151 { 153 {
152#if VERBOSE_CLIENT 154#if VERBOSE_CLIENT
153 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, "Client: %X was suspended, unpausing\n", s->client_put); 155 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
156 "Client: %X was suspended, unpausing\n", s->client_put);
154#endif 157#endif
155 s->client_put_paused = GNUNET_NO; 158 s->client_put_paused = GNUNET_NO;
156 curl_easy_pause(s->client_put, CURLPAUSE_CONT); 159 curl_easy_pause(s->client_put, CURLPAUSE_CONT);
@@ -193,7 +196,16 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
193 CURL *easy_h = msg->easy_handle; 196 CURL *easy_h = msg->easy_handle;
194 struct Session *s = NULL; 197 struct Session *s = NULL;
195 char * d = (char *) s; 198 char * d = (char *) s;
196 GNUNET_assert (easy_h != NULL); 199
200
201 //GNUNET_assert (easy_h != NULL);
202 if (easy_h == NULL)
203 {
204 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name,
205 "Client: Unknown connection to ended with reason `%s'\n",
206 curl_easy_strerror(msg->data.result));
207 continue;
208 }
197 209
198 GNUNET_assert (CURLE_OK == curl_easy_getinfo(easy_h, CURLINFO_PRIVATE, &d)); 210 GNUNET_assert (CURLE_OK == curl_easy_getinfo(easy_h, CURLINFO_PRIVATE, &d));
199 s = (struct Session *) d; 211 s = (struct Session *) d;
@@ -201,10 +213,13 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
201 213
202 if (msg->msg == CURLMSG_DONE) 214 if (msg->msg == CURLMSG_DONE)
203 { 215 {
204#if DEBUG_HTTP
205 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 216 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
206 "Client: %X connection to '%s' %s ended\n", msg->easy_handle, GNUNET_i2s(&s->target), GNUNET_a2s (s->addr, s->addrlen)); 217 "Client: %X connection to '%s' %s ended with reason %i: `%s'\n",
207#endif 218 msg->easy_handle, GNUNET_i2s(&s->target),
219 http_plugin_address_to_string (NULL, s->addr, s->addrlen),
220 msg->data.result,
221 curl_easy_strerror(msg->data.result));
222
208 client_disconnect(s); 223 client_disconnect(s);
209 //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)); 224 //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));
210 notify_session_end (plugin, &s->target, s); 225 notify_session_end (plugin, &s->target, s);
@@ -311,7 +326,8 @@ client_receive_mst_cb (void *cls, void *client,
311 { 326 {
312#if VERBOSE_CLIENT 327#if VERBOSE_CLIENT
313 struct Plugin *plugin = s->plugin; 328 struct Plugin *plugin = s->plugin;
314 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Client: peer `%s' address `%s' next read delayed for %llu ms\n", 329 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
330 "Client: peer `%s' address `%s' next read delayed for %llu ms\n",
315 GNUNET_i2s (&s->target), GNUNET_a2s (s->addr, s->addrlen), delay); 331 GNUNET_i2s (&s->target), GNUNET_a2s (s->addr, s->addrlen), delay);
316#endif 332#endif
317 } 333 }
@@ -354,7 +370,8 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls)
354 370
355#if VERBOSE_CLIENT 371#if VERBOSE_CLIENT
356 struct Plugin *plugin = s->plugin; 372 struct Plugin *plugin = s->plugin;
357 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Client: Received %Zu bytes from peer `%s'\n", 373 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
374 "Client: Received %Zu bytes from peer `%s'\n",
358 len, 375 len,
359 GNUNET_i2s (&s->target)); 376 GNUNET_i2s (&s->target));
360#endif 377#endif
@@ -413,7 +430,8 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
413 if (msg == NULL) 430 if (msg == NULL)
414 { 431 {
415#if VERBOSE_CLIENT 432#if VERBOSE_CLIENT
416 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Client: %X Nothing to send! Suspending PUT handle!\n", s->client_put); 433 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
434 "Client: %X Nothing to send! Suspending PUT handle!\n", s->client_put);
417#endif 435#endif
418 s->client_put_paused = GNUNET_YES; 436 s->client_put_paused = GNUNET_YES;
419 return CURL_READFUNC_PAUSE; 437 return CURL_READFUNC_PAUSE;
@@ -480,7 +498,9 @@ client_connect (struct Session *s)
480 498
481 plugin->last_tag++; 499 plugin->last_tag++;
482 /* create url */ 500 /* create url */
483 GNUNET_asprintf (&url, "%s%s;%u", http_plugin_address_to_string (plugin, s->addr, s->addrlen), GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag); 501 GNUNET_asprintf (&url, "%s%s;%u",
502 http_plugin_address_to_string (plugin, s->addr, s->addrlen),
503 GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag);
484#if 0 504#if 0
485 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 505 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
486 "URL `%s'\n", 506 "URL `%s'\n",