Show More
@@ -95,7 +95,7 from mercurial import pycompat | |||
|
95 | 95 | |
|
96 | 96 | # hook for threads |
|
97 | 97 | |
|
98 |
globals()[ |
|
|
98 | globals()['_GLOBAL_DONE'] = 0 | |
|
99 | 99 | |
|
100 | 100 | # Some timing constants |
|
101 | 101 | |
@@ -949,7 +949,7 class Engine(threading.Thread): | |||
|
949 | 949 | self.start() |
|
950 | 950 | |
|
951 | 951 | def run(self): |
|
952 |
while not globals()[ |
|
|
952 | while not globals()['_GLOBAL_DONE']: | |
|
953 | 953 | rs = self.getReaders() |
|
954 | 954 | if len(rs) == 0: |
|
955 | 955 | # No sockets to manage, but we wait for the timeout |
@@ -965,7 +965,7 class Engine(threading.Thread): | |||
|
965 | 965 | try: |
|
966 | 966 | self.readers[sock].handle_read() |
|
967 | 967 | except Exception: |
|
968 |
if not globals()[ |
|
|
968 | if not globals()['_GLOBAL_DONE']: | |
|
969 | 969 | traceback.print_exc() |
|
970 | 970 | except Exception: |
|
971 | 971 | pass |
@@ -1045,7 +1045,7 class Reaper(threading.Thread): | |||
|
1045 | 1045 | def run(self): |
|
1046 | 1046 | while True: |
|
1047 | 1047 | self.zeroconf.wait(10 * 1000) |
|
1048 |
if globals()[ |
|
|
1048 | if globals()['_GLOBAL_DONE']: | |
|
1049 | 1049 | return |
|
1050 | 1050 | now = currentTimeMillis() |
|
1051 | 1051 | for record in self.zeroconf.cache.entries(): |
@@ -1118,7 +1118,7 class ServiceBrowser(threading.Thread): | |||
|
1118 | 1118 | now = currentTimeMillis() |
|
1119 | 1119 | if len(self.list) == 0 and self.nexttime > now: |
|
1120 | 1120 | self.zeroconf.wait(self.nexttime - now) |
|
1121 |
if globals()[ |
|
|
1121 | if globals()['_GLOBAL_DONE'] or self.done: | |
|
1122 | 1122 | return |
|
1123 | 1123 | now = currentTimeMillis() |
|
1124 | 1124 | |
@@ -1408,7 +1408,7 class Zeroconf: | |||
|
1408 | 1408 | def __init__(self, bindaddress=None): |
|
1409 | 1409 | """Creates an instance of the Zeroconf class, establishing |
|
1410 | 1410 | multicast communications, listening and reaping threads.""" |
|
1411 |
globals()[ |
|
|
1411 | globals()['_GLOBAL_DONE'] = 0 | |
|
1412 | 1412 | if bindaddress is None: |
|
1413 | 1413 | self.intf = socket.gethostbyname(socket.gethostname()) |
|
1414 | 1414 | else: |
@@ -1848,8 +1848,8 class Zeroconf: | |||
|
1848 | 1848 | def close(self): |
|
1849 | 1849 | """Ends the background threads, and prevent this instance from |
|
1850 | 1850 | servicing further queries.""" |
|
1851 |
if globals()[ |
|
|
1852 |
globals()[ |
|
|
1851 | if globals()['_GLOBAL_DONE'] == 0: | |
|
1852 | globals()['_GLOBAL_DONE'] = 1 | |
|
1853 | 1853 | self.notifyAll() |
|
1854 | 1854 | self.engine.notify() |
|
1855 | 1855 | self.unregisterAllServices() |
General Comments 0
You need to be logged in to leave comments.
Login now