]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
vici: Allow callers of listen() to distinguish between disconnects and intended breaks
authorTobias Brunner <tobias@strongswan.org>
Wed, 8 Oct 2025 14:21:33 +0000 (16:21 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 8 Oct 2025 14:53:01 +0000 (16:53 +0200)
src/libcharon/plugins/vici/python/vici/event_listener.py

index f659362a14e5a0793ea5624007beb6e4bc4445ed..f2cc6c8cff9933846bc3631b45229fb03e2f0803 100644 (file)
@@ -118,11 +118,13 @@ class EventListener(object):
 
         :param timeout: timeout to wait for events, in fractions of a second
         :type timeout: float
+        :return: True if StopListening was raised, False if no session available
+        :rtype: bool
         """
         while True:
             try:
                 if self.session is None:
-                    break
+                    return False
                 for label, event in self.session.listen(self.event_map.keys(),
                                                         timeout):
                     if label is None and event is None:
@@ -141,4 +143,4 @@ class EventListener(object):
                     func(self)
                 continue
             except StopListening:
-                break
+                return True