diff options
Diffstat (limited to 'bitbake/lib/bb/ui/uievent.py')
-rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index a900555e33..df22e253ca 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
@@ -45,27 +45,24 @@ class BBUIEventQueue: | |||
45 | server.socket.settimeout(1) | 45 | server.socket.settimeout(1) |
46 | 46 | ||
47 | self.EventHandle = None | 47 | self.EventHandle = None |
48 | count_tries = 0 | ||
49 | 48 | ||
50 | # the event handler registration may fail here due to cooker being in invalid state | 49 | # the event handler registration may fail here due to cooker being in invalid state |
51 | # this is a transient situation, and we should retry a couple of times before | 50 | # this is a transient situation, and we should retry a couple of times before |
52 | # giving up | 51 | # giving up |
53 | 52 | ||
54 | while self.EventHandle == None and count_tries < 5: | 53 | for count_tries in range(5): |
55 | self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port) | 54 | self.EventHandle, error = self.BBServer.registerEventHandler(self.host, self.port) |
56 | 55 | ||
57 | if (self.EventHandle != None): | 56 | if self.EventHandle != None: |
58 | break | 57 | break |
59 | 58 | ||
60 | errmsg = "Could not register UI event handler. Error: %s, " \ | 59 | errmsg = "Could not register UI event handler. Error: %s, host %s, "\ |
61 | "host %s, port %d" % (error, self.host, self.port) | 60 | "port %d" % (error, self.host, self.port) |
62 | bb.warn("%s, retry" % errmsg) | 61 | bb.warn("%s, retry" % errmsg) |
63 | count_tries += 1 | 62 | |
64 | import time | 63 | import time |
65 | time.sleep(1) | 64 | time.sleep(1) |
66 | 65 | else: | |
67 | |||
68 | if self.EventHandle == None: | ||
69 | raise Exception(errmsg) | 66 | raise Exception(errmsg) |
70 | 67 | ||
71 | self.server = server | 68 | self.server = server |