aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-09-24 09:53:13 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-09-24 09:53:13 +0000
commitcf36dd20e6058dc01e70911fe4ba82b2c5b6034b (patch)
treecf9a3a35d429bd3073c193112d7f9c615ec36ad6 /src/transport
parentd0e14875b454a8450de7a26dbf20274f8d29e906 (diff)
downloadgnunet-cf36dd20e6058dc01e70911fe4ba82b2c5b6034b.tar.gz
gnunet-cf36dd20e6058dc01e70911fe4ba82b2c5b6034b.zip
changes
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/plugin_transport_http_client.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 71772a185..7dbbe7b9f 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -450,7 +450,7 @@ http_client_plugin_send (void *cls,
450 } 450 }
451 451
452 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name, 452 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
453 "Session %p/connection %p: Sending message with %u to peer `%s' with \n", 453 "Session %p/connection %p: Sending message with %u to peer `%s' \n",
454 s, s->client_put, 454 s, s->client_put,
455 msgbuf_size, GNUNET_i2s (&s->target)); 455 msgbuf_size, GNUNET_i2s (&s->target));
456 456
@@ -465,20 +465,15 @@ http_client_plugin_send (void *cls,
465 memcpy (msg->buf, msgbuf, msgbuf_size); 465 memcpy (msg->buf, msgbuf, msgbuf_size);
466 GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, s->msg_tail, msg); 466 GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, s->msg_tail, msg);
467 467
468 if (GNUNET_YES == s->put_tmp_disconnected) 468 if (GNUNET_YES == s->put_tmp_disconnecting)
469 { 469 {
470 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name, 470 /* PUT connection is currently getting disconnected */
471 "Session %p: Reconnecting PUT connection\n", 471 GNUNET_break (0);
472 s); 472 return msgbuf_size;
473 s->put_tmp_disconnected = GNUNET_NO;
474 if (GNUNET_SYSERR == client_connect_put (s))
475 {
476 return GNUNET_SYSERR;
477 }
478 } 473 }
479 474 else if (GNUNET_YES == s->put_paused)
480 if (GNUNET_YES == s->put_paused)
481 { 475 {
476 /* PUT connection was paused, unpause */
482 GNUNET_assert (s->put_disconnect_task != GNUNET_SCHEDULER_NO_TASK); 477 GNUNET_assert (s->put_disconnect_task != GNUNET_SCHEDULER_NO_TASK);
483 GNUNET_SCHEDULER_cancel (s->put_disconnect_task); 478 GNUNET_SCHEDULER_cancel (s->put_disconnect_task);
484 s->put_disconnect_task = GNUNET_SCHEDULER_NO_TASK; 479 s->put_disconnect_task = GNUNET_SCHEDULER_NO_TASK;
@@ -488,6 +483,20 @@ http_client_plugin_send (void *cls,
488 s->put_paused = GNUNET_NO; 483 s->put_paused = GNUNET_NO;
489 curl_easy_pause (s->client_put, CURLPAUSE_CONT); 484 curl_easy_pause (s->client_put, CURLPAUSE_CONT);
490 } 485 }
486 else if (GNUNET_YES == s->put_tmp_disconnected)
487 {
488 /* PUT connection was disconnected, reconnect */
489 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
490 "Session %p: Reconnecting PUT connection\n",
491 s);
492 s->put_tmp_disconnected = GNUNET_NO;
493 GNUNET_break (s->client_put == NULL);
494 if (GNUNET_SYSERR == client_connect_put (s))
495 {
496 return GNUNET_SYSERR;
497 }
498 }
499
491 client_schedule (s->plugin, GNUNET_YES); 500 client_schedule (s->plugin, GNUNET_YES);
492 client_reschedule_session_timeout (s); 501 client_reschedule_session_timeout (s);
493 return msgbuf_size; 502 return msgbuf_size;
@@ -732,8 +741,6 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
732 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name, 741 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
733 "Session %p/connection %p: disconnect due to inactivity\n", 742 "Session %p/connection %p: disconnect due to inactivity\n",
734 s, s->client_put); 743 s, s->client_put);
735 s->put_tmp_disconnecting = GNUNET_NO;
736 s->put_tmp_disconnected = GNUNET_YES;
737 return 0; 744 return 0;
738 } 745 }
739 746
@@ -1066,6 +1073,8 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1066 } 1073 }
1067 curl_multi_remove_handle (plugin->curl_multi_handle, easy_h); 1074 curl_multi_remove_handle (plugin->curl_multi_handle, easy_h);
1068 curl_easy_cleanup (easy_h); 1075 curl_easy_cleanup (easy_h);
1076 s->put_tmp_disconnecting = GNUNET_NO;
1077 s->put_tmp_disconnected = GNUNET_YES;
1069 s->client_put = NULL; 1078 s->client_put = NULL;
1070 } 1079 }
1071 if (easy_h == s->client_get) 1080 if (easy_h == s->client_get)
@@ -1147,17 +1156,9 @@ client_connect_put (struct Session *s)
1147{ 1156{
1148 CURLMcode mret; 1157 CURLMcode mret;
1149 /* create put connection */ 1158 /* create put connection */
1150 if (NULL == s->client_put) 1159 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
1151 {
1152 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
1153 "Session %p : Init PUT handle \n", s); 1160 "Session %p : Init PUT handle \n", s);
1154 s->client_put = curl_easy_init (); 1161 s->client_put = curl_easy_init ();
1155 }
1156 else
1157 {
1158 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name,
1159 "Session %p : Reusing PUT handle %p \n", s, s->client_put);
1160 }
1161#if VERBOSE_CURL 1162#if VERBOSE_CURL
1162 curl_easy_setopt (s->client_put, CURLOPT_VERBOSE, 1L); 1163 curl_easy_setopt (s->client_put, CURLOPT_VERBOSE, 1L);
1163 curl_easy_setopt (s->client_put, CURLOPT_DEBUGFUNCTION, &client_log); 1164 curl_easy_setopt (s->client_put, CURLOPT_DEBUGFUNCTION, &client_log);