#1065 Init event socket according to mode

Commit 700aa89ea9 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.
more_events
Jose M. Guisado 2022-02-02 08:35:51 +01:00
parent 700aa89ea9
commit fa0e48a778
1 changed files with 3 additions and 1 deletions

View File

@ -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