Browse Source

Log connection attempts to server

master
Juhani Krekelä 1 year ago
parent
commit
424e6c7b67
  1. 2
      constants.py
  2. 6
      ircbot.py

2
constants.py

@ -4,7 +4,7 @@ class logmessage_types(enum.Enum):
sent, received, internal, status = range(4)
class internal_submessage_types(enum.Enum):
quit, error = range(2)
quit, error, server = range(3)
class controlmessage_types(enum.Enum):
quit, reconnect, send_line, ping, ping_timeout = range(5)

6
ircbot.py

@ -50,6 +50,11 @@ class LoggerThread(threading.Thread):
assert len(message_data) == 2
print('--- Error', message_data[1])
elif message_data[0] == internal_submessage_types.server:
assert len(message_data) == 2
assert len(message_data[1]) == 2
print(f'--- Connecting to server {message_data[1][0]}:{message_data[1][1]}')
else:
print('--- ???', message_data)
@ -295,6 +300,7 @@ class ServerThread(threading.Thread):
while True:
# Connect to given server
address = (self.server.host, self.server.port)
self.logging_channel.send((logmessage_types.internal, internal_submessage_types.server, address))
try:
self.server_socket = socket.create_connection(address)
except (ConnectionRefusedError, socket.gaierror):

Loading…
Cancel
Save