From fa0e48a778ceedaad6a1461dda1532a7db9b6579 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Wed, 2 Feb 2022 08:35:51 +0100 Subject: #1065 Init event socket according to mode Commit 700aa89ea99 introduced the use of getattr when getting event socket to avoid errors in case it was not initialized. Prefer to initialize accordingly inside the ogClient class constructor. --- src/ogClient.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/ogClient.py') diff --git a/src/ogClient.py b/src/ogClient.py index 29b2ebf..67e0d51 100644 --- a/src/ogClient.py +++ b/src/ogClient.py @@ -35,6 +35,8 @@ class ogClient: self.event_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.event_sock.setblocking(0) self.event_sock.bind(('127.0.0.1', 55885)) + else: + self.event_sock = None if self.CONFIG['samba']['activate']: assert('user' in self.CONFIG['samba']) @@ -48,7 +50,7 @@ class ogClient: return self.sock def get_event_socket(self): - return getattr(self, 'event_sock', None) + return self.event_sock def get_state(self): return self.state -- cgit v1.2.3-18-g5258