[core] stay in CON_STATE_CLOSE until done with req

Do not switch to CON_STATE_ERROR upon idle timeout if already in
CON_STATE_CLOSE.  Changing to CON_STATE_ERROR might keep resetting
con->close_timeout_ts if repeated calls to shutdown() succeed.
personal/stbuehler/mod-csrf-old
Glenn Strauss 2016-07-20 05:43:39 -04:00
parent 78c79ead4a
commit cb468d333c
1 changed files with 5 additions and 5 deletions

View File

@ -1590,7 +1590,11 @@ int main (int argc, char **argv) {
int changed = 0;
int t_diff;
if (waitevents & FDEVENT_IN) {
if (con->state == CON_STATE_CLOSE) {
if (srv->cur_ts - con->close_timeout_ts > HTTP_LINGER_TIMEOUT) {
changed = 1;
}
} else if (waitevents & FDEVENT_IN) {
if (con->request_count == 1 || con->state != CON_STATE_READ) { /* e.g. CON_STATE_READ_POST || CON_STATE_WRITE */
if (srv->cur_ts - con->read_idle_ts > con->conf.max_read_idle) {
/* time - out */
@ -1649,10 +1653,6 @@ int main (int argc, char **argv) {
}
}
if (con->state == CON_STATE_CLOSE && (srv->cur_ts - con->close_timeout_ts > HTTP_LINGER_TIMEOUT)) {
changed = 1;
}
/* we don't like div by zero */
if (0 == (t_diff = srv->cur_ts - con->connection_start)) t_diff = 1;