diff --git a/trunk/darkhttpd.c b/trunk/darkhttpd.c index 58fd5bb..e91e9aa 100644 --- a/trunk/darkhttpd.c +++ b/trunk/darkhttpd.c @@ -2171,8 +2171,21 @@ static void httpd_poll(void) poll_check_timeout(conn); switch (conn->state) { + case DONE: + /* clean out stale connections while we're at it */ + if (conn->conn_close) + { + LIST_REMOVE(conn, entries); + free_connection(conn); + safefree(conn); + break; + } + /* else */ + recycle_connection(conn); + /* And enqueue as RECV_REQUEST. */ + /* FALLTHROUGH */ + case RECV_REQUEST: - recv_request: MAX_FD_SET(conn->socket, &recv_set); bother_with_timeout = 1; break; @@ -2183,22 +2196,6 @@ static void httpd_poll(void) bother_with_timeout = 1; break; - case DONE: - /* clean out stale connections while we're at it */ - if (conn->conn_close) - { - LIST_REMOVE(conn, entries); - free_connection(conn); - safefree(conn); - } - else - { - recycle_connection(conn); - /* And enqueue as RECV_REQUEST. */ - goto recv_request; - } - break; - default: errx(1, "invalid state"); } }