diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 8a7158e03..e064e71cf 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -243,9 +243,9 @@ server_load_certificate (struct Plugin *plugin) | |||
243 | */ | 243 | */ |
244 | 244 | ||
245 | static void | 245 | static void |
246 | server_reschedule (struct Plugin *plugin, int now) | 246 | server_reschedule (struct Plugin *plugin, struct MHD_Daemon *server, int now) |
247 | { | 247 | { |
248 | if (plugin->server_v4 != NULL) | 248 | if ((server == plugin->server_v4) && (plugin->server_v4 != NULL)) |
249 | { | 249 | { |
250 | if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK) | 250 | if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK) |
251 | { | 251 | { |
@@ -255,7 +255,7 @@ server_reschedule (struct Plugin *plugin, int now) | |||
255 | plugin->server_v4_task = server_schedule (plugin, plugin->server_v4, now); | 255 | plugin->server_v4_task = server_schedule (plugin, plugin->server_v4, now); |
256 | } | 256 | } |
257 | 257 | ||
258 | if (plugin->server_v6 != NULL) | 258 | if ((server == plugin->server_v6) && (plugin->server_v6 != NULL)) |
259 | { | 259 | { |
260 | if (plugin->server_v6_task != GNUNET_SCHEDULER_NO_TASK) | 260 | if (plugin->server_v6_task != GNUNET_SCHEDULER_NO_TASK) |
261 | { | 261 | { |
@@ -347,7 +347,7 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | |||
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | #if VERBOSE_CLIENT | 350 | #if VERBOSE_SERVER |
351 | struct Plugin *plugin = s->plugin; | 351 | struct Plugin *plugin = s->plugin; |
352 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 352 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, |
353 | "Server: %X: sent %u bytes\n", s, bytes_read); | 353 | "Server: %X: sent %u bytes\n", s, bytes_read); |
@@ -536,7 +536,6 @@ create: | |||
536 | GNUNET_break (0); | 536 | GNUNET_break (0); |
537 | goto error; | 537 | goto error; |
538 | } | 538 | } |
539 | |||
540 | s = create_session (plugin, &target, a, a_len, NULL, NULL); | 539 | s = create_session (plugin, &target, a, a_len, NULL, NULL); |
541 | 540 | ||
542 | s->inbound = GNUNET_YES; | 541 | s->inbound = GNUNET_YES; |
@@ -575,7 +574,14 @@ found: | |||
575 | "Server: Setting timeout for %X to %u sec.\n", sc, to); | 574 | "Server: Setting timeout for %X to %u sec.\n", sc, to); |
576 | #endif | 575 | #endif |
577 | MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to); | 576 | MHD_set_connection_option (mhd_connection, MHD_CONNECTION_OPTION_TIMEOUT, to); |
578 | server_reschedule (plugin, GNUNET_NO); | 577 | |
578 | struct MHD_Daemon * d = NULL; | ||
579 | if (s->addrlen == sizeof (struct IPv6HttpAddress)) | ||
580 | d = plugin->server_v6; | ||
581 | if (s->addrlen == sizeof (struct IPv4HttpAddress)) | ||
582 | d = plugin->server_v4; | ||
583 | |||
584 | server_reschedule (plugin, d, GNUNET_NO); | ||
579 | #endif | 585 | #endif |
580 | return sc; | 586 | return sc; |
581 | } | 587 | } |
@@ -732,7 +738,12 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, | |||
732 | MHD_set_connection_option (t->mhd_conn, MHD_CONNECTION_OPTION_TIMEOUT, | 738 | MHD_set_connection_option (t->mhd_conn, MHD_CONNECTION_OPTION_TIMEOUT, |
733 | to); | 739 | to); |
734 | } | 740 | } |
735 | server_reschedule (plugin, GNUNET_NO); | 741 | struct MHD_Daemon *d = NULL; |
742 | if (s->addrlen == sizeof (struct IPv6HttpAddress)) | ||
743 | d = plugin->server_v6; | ||
744 | if (s->addrlen == sizeof (struct IPv4HttpAddress)) | ||
745 | d = plugin->server_v4; | ||
746 | server_reschedule (plugin, d, GNUNET_NO); | ||
736 | #endif | 747 | #endif |
737 | (*upload_data_size) = 0; | 748 | (*upload_data_size) = 0; |
738 | } | 749 | } |
@@ -827,7 +838,12 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection, | |||
827 | } | 838 | } |
828 | plugin->cur_connections--; | 839 | plugin->cur_connections--; |
829 | 840 | ||
830 | server_reschedule (plugin, GNUNET_NO); | 841 | struct MHD_Daemon *d = NULL; |
842 | if (s->addrlen == sizeof (struct IPv6HttpAddress)) | ||
843 | d = plugin->server_v6; | ||
844 | if (s->addrlen == sizeof (struct IPv4HttpAddress)) | ||
845 | d = plugin->server_v4; | ||
846 | server_reschedule (plugin, d, GNUNET_NO); | ||
831 | 847 | ||
832 | if ((s->server_send == NULL) && (s->server_recv == NULL)) | 848 | if ((s->server_send == NULL) && (s->server_recv == NULL)) |
833 | { | 849 | { |
@@ -875,7 +891,17 @@ int | |||
875 | server_send (struct Session *s, struct HTTP_Message *msg) | 891 | server_send (struct Session *s, struct HTTP_Message *msg) |
876 | { | 892 | { |
877 | GNUNET_CONTAINER_DLL_insert (s->msg_head, s->msg_tail, msg); | 893 | GNUNET_CONTAINER_DLL_insert (s->msg_head, s->msg_tail, msg); |
878 | server_reschedule (s->plugin, GNUNET_YES); | 894 | |
895 | if (s->addrlen == sizeof (struct IPv4HttpAddress)) | ||
896 | { | ||
897 | server_reschedule (s->plugin, s->plugin->server_v4 , GNUNET_YES); | ||
898 | } | ||
899 | else if (s->addrlen == sizeof (struct IPv6HttpAddress)) | ||
900 | { | ||
901 | server_reschedule (s->plugin, s->plugin->server_v6 , GNUNET_YES); | ||
902 | } | ||
903 | else | ||
904 | return GNUNET_SYSERR; | ||
879 | return GNUNET_OK; | 905 | return GNUNET_OK; |
880 | } | 906 | } |
881 | 907 | ||
@@ -1142,6 +1168,8 @@ server_start (struct Plugin *plugin) | |||
1142 | plugin->name, plugin->port); | 1168 | plugin->name, plugin->port); |
1143 | return GNUNET_SYSERR; | 1169 | return GNUNET_SYSERR; |
1144 | } | 1170 | } |
1171 | server_reschedule (plugin, plugin->server_v4, GNUNET_NO); | ||
1172 | |||
1145 | if ((plugin->ipv6 == GNUNET_YES) && (plugin->server_v6 == NULL)) | 1173 | if ((plugin->ipv6 == GNUNET_YES) && (plugin->server_v6 == NULL)) |
1146 | { | 1174 | { |
1147 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 1175 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, |
@@ -1149,8 +1177,8 @@ server_start (struct Plugin *plugin) | |||
1149 | plugin->name, plugin->port); | 1177 | plugin->name, plugin->port); |
1150 | return GNUNET_SYSERR; | 1178 | return GNUNET_SYSERR; |
1151 | } | 1179 | } |
1180 | server_reschedule (plugin, plugin->server_v6, GNUNET_NO); | ||
1152 | 1181 | ||
1153 | server_reschedule (plugin, GNUNET_NO); | ||
1154 | 1182 | ||
1155 | #if DEBUG_HTTP | 1183 | #if DEBUG_HTTP |
1156 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1184 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |