tweaked reconnection logic.

This commit is contained in:
jesopo 2016-07-05 12:18:13 +01:00
parent afc8a72f05
commit a09bce0024
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -26,6 +26,7 @@ class Bot(object):
self.servers[new_server.fileno()] = new_server self.servers[new_server.fileno()] = new_server
if connect and new_server.get_setting("connect", True): if connect and new_server.get_setting("connect", True):
self.connect(new_server) self.connect(new_server)
return new_server
def connect(self, server): def connect(self, server):
try: try:
server.connect() server.connect()
@ -94,7 +95,7 @@ class Bot(object):
def reconnect(self, event): def reconnect(self, event):
server_details = self.database.get_server(event["server_id"]) server_details = self.database.get_server(event["server_id"])
server = IRCServer.Server(*server_details, self) server = self.add_server(*server_details, False)
if self.connect(server): if self.connect(server):
self.servers[server.fileno()] = server self.servers[server.fileno()] = server
else: else: