diff options
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 48c8739d5..507cad216 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -311,7 +311,10 @@ static ssize_t | |||
311 | server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | 311 | server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) |
312 | { | 312 | { |
313 | struct Session *s = cls; | 313 | struct Session *s = cls; |
314 | 314 | #if VERBOSE_SERVER | |
315 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, s->plugin->name, | ||
316 | "Server: %X can sent maximum %u \n", s, max); | ||
317 | #endif | ||
315 | struct HTTP_Message *msg; | 318 | struct HTTP_Message *msg; |
316 | int bytes_read = 0; | 319 | int bytes_read = 0; |
317 | 320 | ||
@@ -345,8 +348,7 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | |||
345 | 348 | ||
346 | #if VERBOSE_CLIENT | 349 | #if VERBOSE_CLIENT |
347 | struct Plugin *plugin = s->plugin; | 350 | struct Plugin *plugin = s->plugin; |
348 | 351 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | |
349 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | ||
350 | "Server: %X: sent %u bytes\n", s, bytes_read); | 352 | "Server: %X: sent %u bytes\n", s, bytes_read); |
351 | #endif | 353 | #endif |
352 | return bytes_read; | 354 | return bytes_read; |
@@ -852,8 +854,6 @@ server_disconnect (struct Session *s) | |||
852 | } | 854 | } |
853 | t = t->next; | 855 | t = t->next; |
854 | } | 856 | } |
855 | |||
856 | |||
857 | return GNUNET_OK; | 857 | return GNUNET_OK; |
858 | } | 858 | } |
859 | 859 | ||
@@ -884,7 +884,10 @@ server_v4_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
884 | 884 | ||
885 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 885 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
886 | return; | 886 | return; |
887 | 887 | #if VERBOSE_SERVER | |
888 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
889 | "Running IPv6 server\n"); | ||
890 | #endif | ||
888 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v4)); | 891 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v4)); |
889 | if (plugin->server_v4 != NULL) | 892 | if (plugin->server_v4 != NULL) |
890 | plugin->server_v4_task = | 893 | plugin->server_v4_task = |
@@ -909,7 +912,10 @@ server_v6_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
909 | 912 | ||
910 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 913 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
911 | return; | 914 | return; |
912 | 915 | #if VERBOSE_SERVER | |
916 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
917 | "Running IPv6 server\n"); | ||
918 | #endif | ||
913 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v6)); | 919 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v6)); |
914 | if (plugin->server_v6 != NULL) | 920 | if (plugin->server_v6 != NULL) |
915 | plugin->server_v6_task = | 921 | plugin->server_v6_task = |
@@ -972,6 +978,7 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle, | |||
972 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); | 978 | GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); |
973 | GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1); | 979 | GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1); |
974 | GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); | 980 | GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1); |
981 | |||
975 | if (daemon_handle == plugin->server_v4) | 982 | if (daemon_handle == plugin->server_v4) |
976 | { | 983 | { |
977 | if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK) | 984 | if (plugin->server_v4_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -979,7 +986,10 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle, | |||
979 | GNUNET_SCHEDULER_cancel (plugin->server_v4_task); | 986 | GNUNET_SCHEDULER_cancel (plugin->server_v4_task); |
980 | plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; | 987 | plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; |
981 | } | 988 | } |
982 | 989 | #if VERBOSE_SERVER | |
990 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
991 | "Scheduling IPv4 server task in %llu ms\n", tv); | ||
992 | #endif | ||
983 | ret = | 993 | ret = |
984 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 994 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
985 | GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, | 995 | GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, |
@@ -992,7 +1002,10 @@ server_schedule (struct Plugin *plugin, struct MHD_Daemon *daemon_handle, | |||
992 | GNUNET_SCHEDULER_cancel (plugin->server_v6_task); | 1002 | GNUNET_SCHEDULER_cancel (plugin->server_v6_task); |
993 | plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; | 1003 | plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; |
994 | } | 1004 | } |
995 | 1005 | #if VERBOSE_SERVER | |
1006 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
1007 | "Scheduling IPv6 server task in %llu ms\n", tv); | ||
1008 | #endif | ||
996 | ret = | 1009 | ret = |
997 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1010 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
998 | GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, | 1011 | GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws, |
@@ -1139,6 +1152,11 @@ server_stop (struct Plugin *plugin) | |||
1139 | struct Session *s = NULL; | 1152 | struct Session *s = NULL; |
1140 | struct Session *t = NULL; | 1153 | struct Session *t = NULL; |
1141 | 1154 | ||
1155 | #if VERBOSE_SERVER | ||
1156 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
1157 | "server_stop\n"); | ||
1158 | #endif | ||
1159 | |||
1142 | struct MHD_Daemon *server_v4_tmp = plugin->server_v4; | 1160 | struct MHD_Daemon *server_v4_tmp = plugin->server_v4; |
1143 | 1161 | ||
1144 | plugin->server_v4 = NULL; | 1162 | plugin->server_v4 = NULL; |
@@ -1171,7 +1189,26 @@ server_stop (struct Plugin *plugin) | |||
1171 | s = plugin->server_semi_head; | 1189 | s = plugin->server_semi_head; |
1172 | while (s != NULL) | 1190 | while (s != NULL) |
1173 | { | 1191 | { |
1192 | #if VERBOSE_SERVER | ||
1193 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
1194 | "Deleting semi-sessions %p\n", s); | ||
1195 | #endif | ||
1174 | t = s->next; | 1196 | t = s->next; |
1197 | struct HTTP_Message * msg = s->msg_head; | ||
1198 | struct HTTP_Message * tmp = s->msg_head; | ||
1199 | while (msg != NULL) | ||
1200 | { | ||
1201 | tmp = msg->next; | ||
1202 | |||
1203 | GNUNET_CONTAINER_DLL_remove(s->msg_head,s->msg_tail, msg); | ||
1204 | if (msg->transmit_cont != NULL) | ||
1205 | { | ||
1206 | msg->transmit_cont(msg->transmit_cont_cls, &s->target, GNUNET_SYSERR); | ||
1207 | } | ||
1208 | GNUNET_free (msg); | ||
1209 | msg = tmp; | ||
1210 | } | ||
1211 | |||
1175 | delete_session (s); | 1212 | delete_session (s); |
1176 | s = t; | 1213 | s = t; |
1177 | } | 1214 | } |