]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The CUPS library did not always detect a timed out connection to the server
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 13 Dec 2012 19:57:25 +0000 (19:57 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 13 Dec 2012 19:57:25 +0000 (19:57 +0000)
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

CHANGES-1.6.txt
cups/request.c

index 7ce8f372e6590bb068f17510ed5be6a33048bb9e..c45974b523067655623c9ab2535d454d9968b5ce 100644 (file)
@@ -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
index a04fbb31e33a07b2082a9fe32fa30b0c6a4043dc..f81785d3a2b6455d9a18cdd15304b579288691bb 100644 (file)
@@ -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;
+      }
+    }
   }
 
  /*