diff options
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index ff2d68602..892d97050 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -92,6 +92,11 @@ struct ServerRequest | |||
92 | */ | 92 | */ |
93 | int connected; | 93 | int connected; |
94 | 94 | ||
95 | /** | ||
96 | * Currently suspended | ||
97 | */ | ||
98 | bool suspended; | ||
99 | |||
95 | }; | 100 | }; |
96 | 101 | ||
97 | 102 | ||
@@ -501,7 +506,9 @@ server_wake_up (void *cls) | |||
501 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 506 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
502 | "Session %p: Waking up PUT handle\n", | 507 | "Session %p: Waking up PUT handle\n", |
503 | s); | 508 | s); |
509 | GNUNET_assert (s->server_recv->suspended); | ||
504 | MHD_resume_connection (s->server_recv->mhd_conn); | 510 | MHD_resume_connection (s->server_recv->mhd_conn); |
511 | s->server_recv->suspended = false; | ||
505 | } | 512 | } |
506 | 513 | ||
507 | 514 | ||
@@ -541,7 +548,11 @@ server_delete_session (struct GNUNET_ATS_Session *s) | |||
541 | GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); | 548 | GNUNET_SCHEDULER_cancel (s->recv_wakeup_task); |
542 | s->recv_wakeup_task = NULL; | 549 | s->recv_wakeup_task = NULL; |
543 | if (NULL != s->server_recv) | 550 | if (NULL != s->server_recv) |
551 | { | ||
552 | GNUNET_assert (s->server_recv->suspended); | ||
553 | s->server_recv->suspended = false; | ||
544 | MHD_resume_connection (s->server_recv->mhd_conn); | 554 | MHD_resume_connection (s->server_recv->mhd_conn); |
555 | } | ||
545 | } | 556 | } |
546 | GNUNET_assert (GNUNET_OK == | 557 | GNUNET_assert (GNUNET_OK == |
547 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, | 558 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, |
@@ -578,6 +589,11 @@ server_delete_session (struct GNUNET_ATS_Session *s) | |||
578 | MHD_set_connection_option (s->server_send->mhd_conn, | 589 | MHD_set_connection_option (s->server_send->mhd_conn, |
579 | MHD_CONNECTION_OPTION_TIMEOUT, | 590 | MHD_CONNECTION_OPTION_TIMEOUT, |
580 | 1 /* 0 = no timeout, so this is MIN */); | 591 | 1 /* 0 = no timeout, so this is MIN */); |
592 | if (s->server_send->suspended) | ||
593 | { | ||
594 | s->server_send->suspended = false; | ||
595 | MHD_resume_connection (s->server_send->mhd_conn); | ||
596 | } | ||
581 | server_reschedule (plugin, | 597 | server_reschedule (plugin, |
582 | s->server_send->mhd_daemon, | 598 | s->server_send->mhd_daemon, |
583 | GNUNET_YES); | 599 | GNUNET_YES); |
@@ -760,9 +776,16 @@ http_server_plugin_send (void *cls, | |||
760 | GNUNET_free (stat_txt); | 776 | GNUNET_free (stat_txt); |
761 | 777 | ||
762 | if (NULL != session->server_send) | 778 | if (NULL != session->server_send) |
779 | { | ||
780 | if (session->server_send->suspended) | ||
781 | { | ||
782 | MHD_resume_connection (session->server_send->mhd_conn); | ||
783 | session->server_send->suspended = false; | ||
784 | } | ||
763 | server_reschedule (session->plugin, | 785 | server_reschedule (session->plugin, |
764 | session->server_send->mhd_daemon, | 786 | session->server_send->mhd_daemon, |
765 | GNUNET_YES); | 787 | GNUNET_YES); |
788 | } | ||
766 | return bytes_sent; | 789 | return bytes_sent; |
767 | } | 790 | } |
768 | 791 | ||
@@ -1613,6 +1636,12 @@ server_send_callback (void *cls, | |||
1613 | s); | 1636 | s); |
1614 | return MHD_CONTENT_READER_END_OF_STREAM; | 1637 | return MHD_CONTENT_READER_END_OF_STREAM; |
1615 | } | 1638 | } |
1639 | else | ||
1640 | { | ||
1641 | MHD_suspend_connection (s->server_send->mhd_conn); | ||
1642 | s->server_send->suspended = true; | ||
1643 | return 0; | ||
1644 | } | ||
1616 | return bytes_read; | 1645 | return bytes_read; |
1617 | } | 1646 | } |
1618 | 1647 | ||
@@ -1868,6 +1897,7 @@ server_access_cb (void *cls, | |||
1868 | GNUNET_YES)); | 1897 | GNUNET_YES)); |
1869 | GNUNET_assert(s->server_recv->mhd_conn == mhd_connection); | 1898 | GNUNET_assert(s->server_recv->mhd_conn == mhd_connection); |
1870 | MHD_suspend_connection (s->server_recv->mhd_conn); | 1899 | MHD_suspend_connection (s->server_recv->mhd_conn); |
1900 | s->server_recv->suspended = true; | ||
1871 | if (NULL == s->recv_wakeup_task) | 1901 | if (NULL == s->recv_wakeup_task) |
1872 | s->recv_wakeup_task | 1902 | s->recv_wakeup_task |
1873 | = GNUNET_SCHEDULER_add_delayed (delay, | 1903 | = GNUNET_SCHEDULER_add_delayed (delay, |