Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket: add a waitbc option #3495

Closed
michaelrsweet opened this issue Feb 5, 2010 · 4 comments

Comments

Projects
None yet
1 participant
@michaelrsweet
Copy link
Collaborator

commented Feb 5, 2010

Version: 1.4.2
CUPS.org User: twaugh.redhat

A 'waitbc' option would be useful in the socket backend to ensure that delays are kept to a minimum.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

commented Feb 15, 2010

CUPS.org User: mike

OK, I've opted instead to just make this code conditional on Mac OS X, which is the only platform that needs it. Future versions will no longer include the extra wait at all.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 30, 2010

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 30, 2010

"0001-New-waitbc-option.patch":

From 1affc6b9e0f029b833ad998ba05ab0b206e33a22 Mon Sep 17 00:00:00 2001
From: Tim Waugh twaugh@redhat.com
Date: Fri, 5 Feb 2010 17:14:55 +0000
Subject: [PATCH] New waitbc option.


backend/socket.c | 28 +++++++++++++++++++++-------
doc/help/network.html | 2 ++
2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/backend/socket.c b/backend/socket.c
index 809a82f..a5536ae 100644
--- a/backend/socket.c
+++ b/backend/socket.c
@@ -78,6 +78,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) /
int recoverable; /
Recoverable error shown? /
int contimeout; /
Connection timeout /
int waiteof; /
Wait for end-of-file? */

  • int waitbc; /* Wait for back-channel data? /
    int port; /
    Port number /
    char portname[255]; /
    Port name /
    int delay; /
    Delay for retries... /
    @@ -180,6 +181,7 @@ main(int argc, /
    I - Number of command-line arguments (6 or 7) */
    */

waiteof = 1;

  • waitbc = 1;
    contimeout = 7 * 24 * 60 * 60;

if ((options = strchr(resource, '?')) != NULL)
@@ -248,6 +250,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (atoi(value) > 0)
contimeout = atoi(value);
}

  •  else if (!strcasecmp(name, "waitbc"))
    
  •  {
    
  •   /*
    
  •    \* Set the wait-for-bc value...
    
  • */
  •    waitbc = !value[0] || !strcasecmp(value, "on") ||
    
  •    !strcasecmp(value, "yes") || !strcasecmp(value, "true");
    
  •  }
    
    }
    }

@@ -406,14 +417,17 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
CUPS_LLCAST tbytes);
}

  • /*
  • * Wait up to 5 seconds to get any pending back-channel data...
  • */
  • if (waitbc)
  • {
  • /*
  • * Wait up to 5 seconds to get any pending back-channel data...
  • */
  • wait_time = time(NULL) + 5;
  • while (wait_time >= time(&current_time))
  • if (wait_bc(device_fd, wait_time - current_time) <= 0)
  •  break;
    
  • wait_time = time(NULL) + 5;
  • while (wait_time >= time(&current_time))
  •  if (wait_bc(device_fd, wait_time - current_time) <= 0)
    
  • break;
  • }

if (waiteof)
{
diff --git a/doc/help/network.html b/doc/help/network.html
index 6b23810..5654993 100644
--- a/doc/help/network.html
+++ b/doc/help/network.html
@@ -99,6 +99,8 @@ socket://ip-address-or-hostname:port-number?waiteof=false

The "waiteof" option controls whether the socket backend waits for the printer to complete the printing of the job. The default is to wait.

+

The "waitbc" option controls whether the socket backend
+waits for the printer to send any remaining back-channel data after the job file has been sent. The default is to wait.

Internet Printing Protocol (IPP)

1.6.6

@michaelrsweet

This comment has been minimized.

Copy link
Collaborator Author

commented Mar 30, 2010

"str3495.patch":

Index: backend/socket.c

--- backend/socket.c (revision 8983)
+++ backend/socket.c (working copy)
@@ -3,7 +3,7 @@
*

  • AppSocket backend for the Common UNIX Printing System (CUPS).
  • * Copyright 2007-2009 by Apple Inc.
  • * Copyright 2007-2010 by Apple Inc.
  • Copyright 1997-2007 by Easy Software Products, all rights reserved.
  • These coded instructions, statements, and computer programs are the
    @@ -388,6 +388,7 @@
    CUPS_LLCAST tbytes);
    }

+#ifdef APPLE
/*

  • Wait up to 5 seconds to get any pending back-channel data...
    /
    @@ -396,6 +397,7 @@
    while (wait_time >= time(&current_time))
    if (wait_bc(device_fd, wait_time - current_time) <= 0)
    break;
    +#endif /
    APPLE */

    if (waiteof)
    {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.