From: msweet Date: Wed, 6 May 2015 18:01:04 +0000 (+0000) Subject: The scheduler could get caught in a busy loop (STR #4605) X-Git-Tag: v2.2b1~313 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb00c43fccb5aa2dec8e03bd9783e1ee267266a7;p=thirdparty%2Fcups.git The scheduler could get caught in a busy loop (STR #4605) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12613 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES-2.0.txt b/CHANGES-2.0.txt index 93e4070ddf..3fa315d885 100644 --- a/CHANGES-2.0.txt +++ b/CHANGES-2.0.txt @@ -17,6 +17,7 @@ CHANGES IN CUPS V2.0.3 - The rastertopwg filter did not check for truncated input (STR #4597) - The cups-lpd mini-daemon did not check for request parameters (STR #4603) + - The scheduler could get caught in a busy loop (STR #4605) - Added Russian translation (STR #4577) diff --git a/scheduler/client.c b/scheduler/client.c index c5a9960881..50464a524a 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -585,6 +585,17 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ * connection and we need to shut it down... */ + if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1) + { + /* + * Connection closed... + */ + + cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on EOF."); + cupsdCloseClient(con); + return; + } + cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP read state %s.", httpStateString(httpGetState(con->http))); cupsdCloseClient(con); @@ -1979,12 +1990,6 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ if (httpGetState(con->http) == HTTP_STATE_POST_SEND) { - /* - * Don't listen for activity until we decide to do something with this... - */ - - cupsdAddSelect(httpGetFd(con->http), NULL, NULL, con); - if (con->file >= 0) { fstat(con->file, &filestats);