From: mike Date: Thu, 13 Dec 2012 19:57:25 +0000 (+0000) Subject: The CUPS library did not always detect a timed out connection to the server X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cad84cc685c7e58357ba0faac350a71ed4738f1;p=thirdparty%2Fcups.git The CUPS library did not always detect a timed out connection to the server which could cause temporary loss of printing from applications (STR #4187) git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10760 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index 7ce8f372e6..c45974b523 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -7,6 +7,9 @@ CHANGES IN CUPS V1.6.2 - Security: All file, directory, user, and group settings are now stored in a separate cups-files.conf configuration file that cannot be set through the CUPS web interface or APIs (STR #4223) + - The CUPS library did not always detect a timed out connection to the + server which could cause temporary loss of printing from applications + (STR #4187) - The ipptool program now supports variable substitution in OPERATION and DELAY directives (STR #4175) - The IPP backend now stops queues when the server configuration diff --git a/cups/request.c b/cups/request.c index a04fbb31e3..f81785d3a2 100644 --- a/cups/request.c +++ b/cups/request.c @@ -1007,6 +1007,25 @@ _cupsConnect(void) httpClose(cg->http); cg->http = NULL; } + else + { + /* + * Same server, see if the connection is still established... + */ + + char ch; /* Connection check byte */ + + if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 && + errno != EWOULDBLOCK) + { + /* + * Nope, close the connection... + */ + + httpClose(cg->http); + cg->http = NULL; + } + } } /*