vici: Allow callers of listen() to distinguish between disconnects and intended breaks
This commit is contained in:
@@ -118,11 +118,13 @@ class EventListener(object):
|
|||||||
|
|
||||||
:param timeout: timeout to wait for events, in fractions of a second
|
:param timeout: timeout to wait for events, in fractions of a second
|
||||||
:type timeout: float
|
:type timeout: float
|
||||||
|
:return: True if StopListening was raised, False if no session available
|
||||||
|
:rtype: bool
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
if self.session is None:
|
if self.session is None:
|
||||||
break
|
return False
|
||||||
for label, event in self.session.listen(self.event_map.keys(),
|
for label, event in self.session.listen(self.event_map.keys(),
|
||||||
timeout):
|
timeout):
|
||||||
if label is None and event is None:
|
if label is None and event is None:
|
||||||
@@ -141,4 +143,4 @@ class EventListener(object):
|
|||||||
func(self)
|
func(self)
|
||||||
continue
|
continue
|
||||||
except StopListening:
|
except StopListening:
|
||||||
break
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user