All of lore.kernel.org
 help / color / mirror / Atom feed
* [Printing-architecture] Fix for STR #4187 incomplete, missing part attached
@ 2013-09-05 21:17 Till Kamppeter
  2013-09-09 14:40 ` Michael Sweet
  0 siblings, 1 reply; 4+ messages in thread
From: Till Kamppeter @ 2013-09-05 21:17 UTC (permalink / raw)
  To: Michael Sweet, Open Printing, Didier Raboud

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

Hi,

it seems that if a CUPS client (like the print dialog of LibreOffice)
stays connected to CUPS for a long time, the connection can get dropped
and the client does not reconnect.

This is handled by the following Ubuntu bug report:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048

and also upstream by the following report in the former STR system:

http://www.cups.org/str.php?L4187

The STR was considered fixed by applying a patch, but the reporter of
the Ubuntu bug has found out that another patch is needed to complete
the fix. See comment #37 in the Ubuntu report:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048/comments/37

The current CUPS 1.7.0rc1 has this "else" part but there is still
missing that "if" has also to close the connection when the result of
the recv() function is zero, meaning EOF, which happens when the server
terminates the connection.-

The attached patch adds this missing part.

In comment #44 of the Ubuntu report it is confirmed that this missing
piece applied fixes the problem completely:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048/comments/44

Can you apply this patch to the final CUPS 1.7.0? Thanks.

   Till


[-- Attachment #2: handle-server-terminating-connection.patch --]
[-- Type: text/x-patch, Size: 643 bytes --]

--- a/cups/request.c
+++ b/cups/request.c
@@ -1018,13 +1018,14 @@
       */
 
       char ch;				/* Connection check byte */
+      int n;
 
 #ifdef WIN32
-      if (recv(cg->http->fd, &ch, 1, MSG_PEEK) < 0 &&
-          WSAGetLastError() != WSAEWOULDBLOCK)
+      if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK) == 0) ||
+          (n < 0 && WSAGetLastError() != WSAEWOULDBLOCK))
 #else
-      if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 &&
-          errno != EWOULDBLOCK)
+      if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) == 0) ||
+	  (n < 0 && errno != EWOULDBLOCK))
 #endif /* WIN32 */
       {
        /*

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-09 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-05 21:17 [Printing-architecture] Fix for STR #4187 incomplete, missing part attached Till Kamppeter
2013-09-09 14:40 ` Michael Sweet
2013-09-09 19:48   ` Till Kamppeter
2013-09-09 20:49     ` Michael Sweet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.