3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

core: refresh various serverdata attributes on REHASH

This commit is contained in:
James Lu 2015-10-02 23:07:57 -07:00
parent f20e677577
commit 7e57798f4d
2 changed files with 8 additions and 2 deletions

View File

@ -21,6 +21,11 @@ class ProtocolError(Exception):
class Irc():
def initVars(self):
self.sid = self.serverdata["sid"]
self.botdata = self.conf['bot']
self.pingfreq = self.serverdata.get('pingfreq') or 30
self.pingtimeout = self.pingfreq * 2
self.connected.clear()
self.aborted.clear()
self.pseudoclient = None
@ -88,10 +93,10 @@ class Irc():
self.pingTimer = None
def connect(self):
ip = self.serverdata["ip"]
port = self.serverdata["port"]
while True:
self.initVars()
ip = self.serverdata["ip"]
port = self.serverdata["port"]
checks_ok = True
try:
self.socket = socket.socket()

View File

@ -341,6 +341,7 @@ def rehash(irc, source, args):
del world.networkobjects[network]
else:
ircobj.conf = new_conf
ircobj.serverdata = new_conf['servers'][network]
for network, sdata in new_conf['servers'].items():
# New server was added. Connect them if not already connected.
if network not in world.networkobjects: