All of lore.kernel.org
 help / color / mirror / Atom feed
From: Till Kamppeter <till.kamppeter@gmail.com>
To: Michael Sweet <msweet@apple.com>,
	Open Printing <printing-architecture@lists.linux-foundation.org>,
	Didier Raboud <odyx@debian.org>
Subject: [Printing-architecture] Fix for STR #4187 incomplete, missing part attached
Date: Thu, 05 Sep 2013 23:17:25 +0200	[thread overview]
Message-ID: <5228F4E5.8030203@gmail.com> (raw)

[-- 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 */
       {
        /*

             reply	other threads:[~2013-09-05 21:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 21:17 Till Kamppeter [this message]
2013-09-09 14:40 ` [Printing-architecture] Fix for STR #4187 incomplete, missing part attached Michael Sweet
2013-09-09 19:48   ` Till Kamppeter
2013-09-09 20:49     ` Michael Sweet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5228F4E5.8030203@gmail.com \
    --to=till.kamppeter@gmail.com \
    --cc=msweet@apple.com \
    --cc=odyx@debian.org \
    --cc=printing-architecture@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.