diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2022-02-02 08:35:51 +0100 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2022-02-02 08:51:34 +0100 |
commit | fa0e48a778ceedaad6a1461dda1532a7db9b6579 (patch) | |
tree | 4b1ba93a263bbf2b204150b21a089eb96101e477 | |
parent | 700aa89ea99c7d48350fb99c947c60fc02c0323e (diff) |
#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.
-rw-r--r-- | src/ogClient.py | 4 |
1 files changed, 3 insertions, 1 deletions
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 |