Connection moved to the end of timeout list in resume_suspended_connections(),
moreover suspended connections are not in DL-list (XDLL_remove may break something) and
timeout DL-list is not maintained in thread-per-connection mode

No need to use 'just_resumed': if connection is suspended again in first DH function,
MHD_connection_update_event_loop_info will be called with 'suspended' flag set.
This commit is contained in:
Evgeny Grin (Karlson2k)
2017-03-22 23:15:34 +03:00
parent 7e1123665e
commit cdcc0126c6
3 changed files with 4 additions and 24 deletions
+4 -7
View File
@@ -1415,11 +1415,10 @@ MHD_connection_update_event_loop_info (struct MHD_Connection *connection)
case MHD_CONNECTION_CONTINUE_SENT:
if (connection->read_buffer_offset == connection->read_buffer_size)
{
if ( (MHD_YES != try_grow_read_buffer (connection)) &&
(0 != (connection->daemon->options &
MHD_USE_INTERNAL_POLLING_THREAD)) &&
(! connection->suspended) &&
(! connection->just_resumed) )
if ((MHD_YES != try_grow_read_buffer (connection)) &&
(0 != (connection->daemon->options &
MHD_USE_INTERNAL_POLLING_THREAD)) &&
(! connection->suspended))
{
/* failed to grow the read buffer, and the
client which is supposed to handle the
@@ -1823,7 +1822,6 @@ call_connection_handler (struct MHD_Connection *connection)
return; /* already queued a response */
processed = 0;
connection->client_aware = true;
connection->just_resumed = false;
if (MHD_NO ==
connection->daemon->default_handler (connection->daemon-> default_handler_cls,
connection,
@@ -1986,7 +1984,6 @@ process_request_body (struct MHD_Connection *connection)
}
used = processed;
connection->client_aware = true;
connection->just_resumed = false;
if (MHD_NO ==
connection->daemon->default_handler (connection->daemon->default_handler_cls,
connection,
-11
View File
@@ -2799,18 +2799,7 @@ MHD_resume_connection (struct MHD_Connection *connection)
MHD_PANIC (_("Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n"));
MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
connection->resuming = true;
connection->just_resumed = true;
daemon->resuming = true;
if (connection->connection_timeout == daemon->connection_timeout)
{
/* move to the end... */
XDLL_remove (daemon->normal_timeout_head,
daemon->normal_timeout_tail,
connection);
XDLL_insert (daemon->normal_timeout_head,
daemon->normal_timeout_tail,
connection);
}
MHD_mutex_unlock_chk_ (&daemon->cleanup_connection_mutex);
if ( (MHD_ITC_IS_VALID_(daemon->itc)) &&
(! MHD_itc_activate_ (daemon->itc, "r")) )
-6
View File
@@ -947,12 +947,6 @@ struct MHD_Connection
* Is the connection wanting to resume?
*/
bool resuming;
/**
* Did the connection just resume? (Means we are generous
* in dealing with a full read buffer...).
*/
bool just_resumed;
};