]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Optimize connection usage in the IPP backend.
authorMichael R Sweet <michaelrsweet@gmail.com>
Mon, 16 Jan 2017 17:00:25 +0000 (12:00 -0500)
committerMichael R Sweet <michaelrsweet@gmail.com>
Mon, 16 Jan 2017 17:00:25 +0000 (12:00 -0500)
CHANGES.txt
backend/ipp.c

index dc25152fd05b932b921dc3297ad6d7a84cd16176..707adc565abd5de7b646dbfa2d5f014a921855c2 100644 (file)
@@ -7,6 +7,8 @@ CHANGES IN CUPS V2.2.2
        - Fixed some issues with IPP Everywhere printer support (Issue #4893,
          Issue #4909, Issue #4916, Issue #4921, Issue #4923, Issue #4932,
          Issue #4933, Issue #4938)
+       - Optimized connection usage in the IPP backend
+         (<rdar://problem/29547323>)
        - The scheduler did not detect when an encrypted connection was closed
          by the client on Linux (Issue #4901)
        - The cups-lpd program did not catch all legacy usage of ISO-8859-1
index a338577f9dc20de788a658b7fb902cf9444f9524..6eefd144e7a54a19e5a98a6a8193a52e21075f55 100644 (file)
@@ -2430,10 +2430,13 @@ monitor_printer(
   while (monitor->job_state < IPP_JOB_CANCELED && !job_canceled)
   {
    /*
-    * Reconnect to the printer...
+    * Reconnect to the printer as needed...
     */
 
-    if (!httpReconnect(http))
+    if (httpGetFd(http) < 0)
+      httpReconnect(http);
+
+    if (httpGetFd(http) >= 0)
     {
      /*
       * Connected, so check on the printer state...
@@ -2452,7 +2455,7 @@ monitor_printer(
         * No job-id yet, so continue...
        */
 
-        goto monitor_disconnect;
+        goto monitor_sleep;
       }
 
      /*
@@ -2613,20 +2616,14 @@ monitor_printer(
           (monitor->job_state == IPP_JOB_CANCELED ||
           monitor->job_state == IPP_JOB_ABORTED))
        job_canceled = -1;
-
-     /*
-      * Disconnect from the printer - we'll reconnect on the next poll...
-      */
-
-      monitor_disconnect:
-
-      _httpDisconnect(http);
     }
 
    /*
     * Sleep for N seconds...
     */
 
+    monitor_sleep:
+
     sleep((unsigned)delay);
 
     delay = _cupsNextDelay(delay, &prev_delay);
@@ -2638,7 +2635,10 @@ monitor_printer(
 
   if (job_canceled > 0 && monitor->job_id > 0)
   {
-    if (!httpReconnect(http))
+    if (httpGetFd(http) < 0)
+      httpReconnect(http);
+
+    if (httpGetFd(http) >= 0)
     {
       cancel_job(http, monitor->uri, monitor->job_id, monitor->resource,
                  monitor->user, monitor->version);