aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-04 09:20:47 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-04 09:20:47 +0000
commit21b693fef55a0cccbd82b9f8f287b9efb0aacf56 (patch)
tree39a8dc2b1669d8112238fba491701de270ce81e0 /src/transport
parent334fa530a1475ac067e1d3f26bb588794b59baad (diff)
downloadgnunet-21b693fef55a0cccbd82b9f8f287b9efb0aacf56.tar.gz
gnunet-21b693fef55a0cccbd82b9f8f287b9efb0aacf56.zip
bugfixes
timeout handling for other transmission direction
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/plugin_transport_http_server.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 73c964ceb..786b4fa93 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -185,8 +185,11 @@ server_load_certificate (struct Plugin *plugin)
185 GNUNET_free (cert_file); 185 GNUNET_free (cert_file);
186 186
187 GNUNET_free_non_null (plugin->key); 187 GNUNET_free_non_null (plugin->key);
188 plugin->key = NULL;
188 GNUNET_free_non_null (plugin->cert); 189 GNUNET_free_non_null (plugin->cert);
190 plugin->cert = NULL;
189 GNUNET_free_non_null (plugin->crypto_init); 191 GNUNET_free_non_null (plugin->crypto_init);
192 plugin->crypto_init = NULL;
190 193
191 return GNUNET_SYSERR; 194 return GNUNET_SYSERR;
192 } 195 }
@@ -207,8 +210,11 @@ server_load_certificate (struct Plugin *plugin)
207 GNUNET_free (cert_file); 210 GNUNET_free (cert_file);
208 211
209 GNUNET_free_non_null (plugin->key); 212 GNUNET_free_non_null (plugin->key);
213 plugin->key = NULL;
210 GNUNET_free_non_null (plugin->cert); 214 GNUNET_free_non_null (plugin->cert);
215 plugin->cert = NULL;
211 GNUNET_free_non_null (plugin->crypto_init); 216 GNUNET_free_non_null (plugin->crypto_init);
217 plugin->crypto_init = NULL;
212 218
213 return GNUNET_SYSERR; 219 return GNUNET_SYSERR;
214 } 220 }
@@ -222,6 +228,7 @@ server_load_certificate (struct Plugin *plugin)
222} 228}
223#endif 229#endif
224 230
231
225/** 232/**
226 * Reschedule the execution of both IPv4 and IPv6 server 233 * Reschedule the execution of both IPv4 and IPv6 server
227 * @param plugin the plugin 234 * @param plugin the plugin
@@ -515,15 +522,12 @@ found:
515#if MHD_VERSION >= 0x00090E00 522#if MHD_VERSION >= 0x00090E00
516 int to = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000); 523 int to = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000);
517#if VERBOSE_SERVER 524#if VERBOSE_SERVER
518#endif 525 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
519 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
520 "Server: Setting timeout for %X to %u sec.\n", sc, to); 526 "Server: Setting timeout for %X to %u sec.\n", sc, to);
521 527#endif
522 MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to); 528 MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to);
523 server_reschedule (plugin, GNUNET_NO); 529 server_reschedule (plugin, GNUNET_NO);
524#endif 530#endif
525
526
527 return sc; 531 return sc;
528} 532}
529 533
@@ -564,7 +568,6 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
564 } 568 }
565 } 569 }
566 570
567
568 /* existing connection */ 571 /* existing connection */
569 sc = (*httpSessionCache); 572 sc = (*httpSessionCache);
570 s = sc->session; 573 s = sc->session;
@@ -624,10 +627,38 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
624 s->msg_tk = GNUNET_SERVER_mst_create (&server_receive_mst_cb, s); 627 s->msg_tk = GNUNET_SERVER_mst_create (&server_receive_mst_cb, s);
625 } 628 }
626 res = GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data, *upload_data_size, GNUNET_NO, GNUNET_NO); 629 res = GNUNET_SERVER_mst_receive (s->msg_tk, s, upload_data, *upload_data_size, GNUNET_NO, GNUNET_NO);
630
631#if MHD_VERSION >= 0x00090E00
632#endif
633 int to = (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT.rel_value / 1000);
634 struct ServerConnection *t = NULL;
635
627#if VERBOSE_SERVER 636#if VERBOSE_SERVER
628 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 637 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
629 "Server: Received %Zu bytes\n", *upload_data_size); 638 "Server: Received %Zu bytes\n", *upload_data_size);
630#endif 639#endif
640
641 /* Setting timeouts for other connections */
642 if (s->server_recv != NULL)
643 {
644 t = s->server_recv;
645#if VERBOSE_SERVER
646 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
647 "Server: Setting timeout for %X to %u sec.\n", t, to);
648#endif
649 MHD_set_connection_option (t->mhd_conn, MHD_CONNECTION_OPTION_TIMEOUT, to);
650 }
651 if (s->server_send != NULL)
652 {
653 t = s->server_send;
654#if VERBOSE_SERVER
655 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
656 "Server: Setting timeout for %X to %u sec.\n", t, to);
657#endif
658 MHD_set_connection_option (t->mhd_conn, MHD_CONNECTION_OPTION_TIMEOUT, to);
659 }
660 server_reschedule (plugin, GNUNET_NO);
661
631 (*upload_data_size) = 0; 662 (*upload_data_size) = 0;
632 } 663 }
633 else 664 else
@@ -855,9 +886,11 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle, int no
855 { 886 {
856 if (timeout != last_timeout) 887 if (timeout != last_timeout)
857 { 888 {
889#if VERBOSE_SERVER
858 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, 890 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,
859 "SELECT Timeout changed from %llu to %llu\n", 891 "SELECT Timeout changed from %llu to %llu\n",
860 last_timeout, timeout); 892 last_timeout, timeout);
893#endif
861 last_timeout = timeout; 894 last_timeout = timeout;
862 } 895 }
863 tv.rel_value = (uint64_t) timeout; 896 tv.rel_value = (uint64_t) timeout;
@@ -1052,8 +1085,6 @@ server_stop (struct Plugin *plugin)
1052 while (s != NULL) 1085 while (s != NULL)
1053 { 1086 {
1054 t = s->next; 1087 t = s->next;
1055 if (s->msg_tk != NULL)
1056 GNUNET_SERVER_mst_destroy(s->msg_tk);
1057 delete_session (s); 1088 delete_session (s);
1058 s = t; 1089 s = t;
1059 } 1090 }