aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-02-15 07:24:35 +0100
committerChristian Grothoff <christian@grothoff.org>2018-02-15 07:24:35 +0100
commit9562d1656d683cce2a2557fc0c2e5573fabfc6bb (patch)
tree6a6d3df45148c5c73111d3ca7e95b72eeff967bb
parente76b3a78104ab4d6b939a50fe1de446b34296916 (diff)
downloadlibmicrohttpd-9562d1656d683cce2a2557fc0c2e5573fabfc6bb.tar.gz
libmicrohttpd-9562d1656d683cce2a2557fc0c2e5573fabfc6bb.zip
implement request_resume
-rw-r--r--src/lib/connection_add.c2
-rw-r--r--src/lib/daemon_epoll.c2
-rw-r--r--src/lib/daemon_poll.c2
-rw-r--r--src/lib/daemon_select.c2
-rw-r--r--src/lib/internal.h5
-rw-r--r--src/lib/request_resume.c19
6 files changed, 27 insertions, 5 deletions
diff --git a/src/lib/connection_add.c b/src/lib/connection_add.c
index 8d4f12ad..94d37442 100644
--- a/src/lib/connection_add.c
+++ b/src/lib/connection_add.c
@@ -369,7 +369,7 @@ thread_main_handle_connection (void *data)
369 * moved immediately to cleanup list. Otherwise connection 369 * moved immediately to cleanup list. Otherwise connection
370 * will stay in suspended list until 'urh' will be marked 370 * will stay in suspended list until 'urh' will be marked
371 * with 'was_closed' by application. */ 371 * with 'was_closed' by application. */
372 MHD_resume_connection (con); 372 MHD_request_resume (&con->request);
373 373
374 /* skip usual clean up */ 374 /* skip usual clean up */
375 return (MHD_THRD_RTRN_TYPE_) 0; 375 return (MHD_THRD_RTRN_TYPE_) 0;
diff --git a/src/lib/daemon_epoll.c b/src/lib/daemon_epoll.c
index 49f15307..1c336f41 100644
--- a/src/lib/daemon_epoll.c
+++ b/src/lib/daemon_epoll.c
@@ -188,7 +188,7 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
188 * will be moved immediately to cleanup list. Otherwise 188 * will be moved immediately to cleanup list. Otherwise
189 * connection will stay in suspended list until 'pos' will 189 * connection will stay in suspended list until 'pos' will
190 * be marked with 'was_closed' by application. */ 190 * be marked with 'was_closed' by application. */
191 MHD_resume_connection (pos->connection); 191 MHD_request_resume (&pos->connection->request);
192 } 192 }
193 } 193 }
194 194
diff --git a/src/lib/daemon_poll.c b/src/lib/daemon_poll.c
index d5660715..bc705aea 100644
--- a/src/lib/daemon_poll.c
+++ b/src/lib/daemon_poll.c
@@ -326,7 +326,7 @@ MHD_daemon_poll_all_ (struct MHD_Daemon *daemon,
326 * moved immediately to cleanup list. Otherwise connection 326 * moved immediately to cleanup list. Otherwise connection
327 * will stay in suspended list until 'urh' will be marked 327 * will stay in suspended list until 'urh' will be marked
328 * with 'was_closed' by application. */ 328 * with 'was_closed' by application. */
329 MHD_resume_connection(urh->connection); 329 MHD_request_resume (&urh->connection->request);
330 } 330 }
331 } 331 }
332#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 332#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
diff --git a/src/lib/daemon_select.c b/src/lib/daemon_select.c
index abd6eacf..338b12d5 100644
--- a/src/lib/daemon_select.c
+++ b/src/lib/daemon_select.c
@@ -468,7 +468,7 @@ internal_run_from_select (struct MHD_Daemon *daemon,
468 MHD_connection_finish_forward_ (urh->connection); 468 MHD_connection_finish_forward_ (urh->connection);
469 urh->clean_ready = true; 469 urh->clean_ready = true;
470 /* Resuming will move connection to cleanup list. */ 470 /* Resuming will move connection to cleanup list. */
471 MHD_resume_connection(urh->connection); 471 MHD_request_resume (&urh->connection->request);
472 } 472 }
473 } 473 }
474#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */ 474#endif /* HTTPS_SUPPORT && UPGRADE_SUPPORT */
diff --git a/src/lib/internal.h b/src/lib/internal.h
index 1e95698e..8d1f22d8 100644
--- a/src/lib/internal.h
+++ b/src/lib/internal.h
@@ -1542,6 +1542,11 @@ struct MHD_Daemon
1542 bool was_quiesced; 1542 bool was_quiesced;
1543 1543
1544 /** 1544 /**
1545 * Is some connection wanting to resume?
1546 */
1547 bool resuming;
1548
1549 /**
1545 * Allow reusing the address:port combination when binding. 1550 * Allow reusing the address:port combination when binding.
1546 * See #MHD_daemon_listen_allow_address_reuse(). 1551 * See #MHD_daemon_listen_allow_address_reuse().
1547 */ 1552 */
diff --git a/src/lib/request_resume.c b/src/lib/request_resume.c
index cd642580..fcb9a5a3 100644
--- a/src/lib/request_resume.c
+++ b/src/lib/request_resume.c
@@ -42,7 +42,24 @@
42void 42void
43MHD_request_resume (struct MHD_Request *request) 43MHD_request_resume (struct MHD_Request *request)
44{ 44{
45 abort (); // not implemented... 45 struct MHD_Daemon *daemon = request->daemon;
46
47 if (daemon->disallow_suspend_resume)
48 MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n"));
49 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
50 request->connection->resuming = true;
51 daemon->resuming = true;
52 MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
53 if ( (MHD_ITC_IS_VALID_(daemon->itc)) &&
54 (! MHD_itc_activate_ (daemon->itc,
55 "r")) )
56 {
57#ifdef HAVE_MESSAGES
58 MHD_DLOG (daemon,
59 MHD_SC_ITC_USE_FAILED,
60 _("Failed to signal resume via inter-thread communication channel."));
61#endif
62 }
46} 63}
47 64
48/* end of request_resume.c */ 65/* end of request_resume.c */