aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/transport/plugin_transport_http_server.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 22f54930c..5e77f71a7 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -128,6 +128,11 @@ struct Session
128 int session_passed; 128 int session_passed;
129 129
130 /** 130 /**
131 * Did we immediately end the session in disconnect_cb
132 */
133 int session_ended;
134
135 /**
131 * Absolute time when to receive data again 136 * Absolute time when to receive data again
132 * Used for receive throttling 137 * Used for receive throttling
133 */ 138 */
@@ -641,7 +646,7 @@ server_delete_session (struct Session *s)
641 struct HTTP_Server_Plugin *plugin = s->plugin; 646 struct HTTP_Server_Plugin *plugin = s->plugin;
642 server_stop_session_timeout(s); 647 server_stop_session_timeout(s);
643 648
644 if (GNUNET_YES == s->session_passed) 649 if ((GNUNET_YES == s->session_passed) && (GNUNET_NO == s->session_ended))
645 plugin->env->session_end (plugin->env->cls, &s->target, s); 650 plugin->env->session_end (plugin->env->cls, &s->target, s);
646 651
647 GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s); 652 GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s);
@@ -763,8 +768,8 @@ server_reschedule (struct HTTP_Server_Plugin *plugin, struct MHD_Daemon *server,
763static int 768static int
764server_disconnect (struct Session *s) 769server_disconnect (struct Session *s)
765{ 770{
766 struct ServerConnection * send; 771 struct ServerConnection * send = NULL;
767 struct ServerConnection * recv; 772 struct ServerConnection * recv = NULL;
768 773
769 send = (struct ServerConnection *) s->server_send; 774 send = (struct ServerConnection *) s->server_send;
770 if (s->server_send != NULL) 775 if (s->server_send != NULL)
@@ -1031,6 +1036,7 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin,
1031 s->server_recv = NULL; 1036 s->server_recv = NULL;
1032 s->server_send = NULL; 1037 s->server_send = NULL;
1033 s->session_passed = GNUNET_NO; 1038 s->session_passed = GNUNET_NO;
1039 s->session_ended = GNUNET_NO;
1034 server_start_session_timeout(s); 1040 server_start_session_timeout(s);
1035 GNUNET_CONTAINER_DLL_insert (plugin->head, plugin->tail, s); 1041 GNUNET_CONTAINER_DLL_insert (plugin->head, plugin->tail, s);
1036 } 1042 }
@@ -1432,6 +1438,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
1432 1438
1433 GNUNET_free (sc); 1439 GNUNET_free (sc);
1434 plugin->cur_connections--; 1440 plugin->cur_connections--;
1441
1435 if ((s->server_send == NULL) && (s->server_recv == NULL)) 1442 if ((s->server_send == NULL) && (s->server_recv == NULL))
1436 { 1443 {
1437 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1444 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
@@ -1441,6 +1448,12 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection,
1441 1448
1442 server_delete_session (s); 1449 server_delete_session (s);
1443 } 1450 }
1451 else if ((GNUNET_YES == s->session_passed) && (GNUNET_NO == s->session_ended))
1452 {
1453 /* Notify transport immediately that this session is invalid */
1454 s->session_ended = GNUNET_YES;
1455 plugin->env->session_end (plugin->env->cls, &s->target, s);
1456 }
1444} 1457}
1445 1458
1446 1459