~ubuntu-branches/ubuntu/natty/system-config-printer/natty-proposed

« back to all changes in this revision

Viewing changes to debian/patches/23_wait-for-cups-daemon-to-listen-after-sighup.patch

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-03-16 23:09:52 UTC
  • Revision ID: james.westby@ubuntu.com-20110316230952-aqf6k4e4l5f4xq9u
Tags: 1.3.1+20110222-0ubuntu8
* debian/patches/35_set-connected-state-when-connecting-to-server-fails.patch:
  Set the "connected" state after a failure of connecting to CUPS, to
  avoid a runtime error (Red Hat bug 685098).
* debian/patches/33_newprintergui-fix-traceback-with-self-printers-not-set.patch:
  New printer wizard crashes when adding a network (AppSocket/JetDirect)
  printer manually (LP: #734968, Red Hat bug #680683).
* debian/patches/23_wait-for-cups-daemon-to-listen-after-sighup.patch,
  debian/patches/23_reconnect-automatically-on-cups-restart.patch:
  Replaced the patch to handle restarts of the CUPS daemon by the solution
  provided by upstream
  (https://fedorahosted.org/system-config-printer/ticket/219). Instead
  of waiting for the CUPS daemon coming back listening for a fixed timeout
  and only after that timeout showing the interface to handle the lost
  CUPS service, we show this screen immediately but in the background we
  listen to D-Bus signals of CUPS. If an appropriate signal appears, we
  cancel this interface immediately and show the CUPS queues again. So we
  can both manually switch to another CUPS server immediately in case of
  a total loss of the original CUPS server and do nothing and wait for
  the original server to come back.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -Nur -x '*.orig' -x '*~' system-config-printer-1.3.1+20110222//system-config-printer.py system-config-printer-1.3.1+20110222.new//system-config-printer.py
2
 
--- system-config-printer-1.3.1+20110222//system-config-printer.py      2011-02-17 17:36:00.000000000 +0100
3
 
+++ system-config-printer-1.3.1+20110222.new//system-config-printer.py  2011-03-09 21:39:19.150627801 +0100
4
 
@@ -2115,7 +2115,29 @@
5
 
 
6
 
     def cups_connection_error (self, mon):
7
 
         try:
8
 
+            if self.cups:
9
 
+                prompt_allowed = self.cups._get_prompt_allowed ()
10
 
+            self.cups._set_prompt_allowed (False)
11
 
+
12
 
+            # With this loop we wait for up to 30 secs whether the CUPS daemon
13
 
+            # comes back listening. To check whether the daemon is listening,
14
 
+            # we try to connect (without dropping any existing connection).
15
 
+            # If the the connection errors, the daemon is not back and we wait
16
 
+            # 1 sec, if it works, we disconnect the extra connection and
17
 
+            # break out of the wait loop.
18
 
+            for i in range (30):
19
 
+                try:
20
 
+                    connection = cups.Connection (host=self.connect_server,
21
 
+                                                  encryption=self.connect_encrypt)
22
 
+                    del connection
23
 
+                    break;
24
 
+                except:
25
 
+                    pass
26
 
+                debugprint("Retrying to connect to CUPS in 1 sec ...")
27
 
+                time.sleep (1)
28
 
+
29
 
             self.cups.getClasses ()
30
 
+            self.cups._set_prompt_allowed (prompt_allowed)
31
 
         except:
32
 
             self.cups = None
33
 
             self.setConnected ()