3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

Irc: require autoconnect value to be >= 1

This prevents sending a flood of connects whenever a server is unreachable.
This commit is contained in:
James Lu 2015-10-02 23:20:59 -07:00
parent 1c8ee5d84b
commit 4e2876104f
2 changed files with 3 additions and 2 deletions

View File

@ -170,10 +170,11 @@ class Irc():
self._disconnect() self._disconnect()
autoconnect = self.serverdata.get('autoconnect') autoconnect = self.serverdata.get('autoconnect')
log.debug('(%s) Autoconnect delay set to %s seconds.', self.name, autoconnect) log.debug('(%s) Autoconnect delay set to %s seconds.', self.name, autoconnect)
if autoconnect is not None and autoconnect >= 0: if autoconnect is not None and autoconnect >= 1:
log.info('(%s) Going to auto-reconnect in %s seconds.', self.name, autoconnect) log.info('(%s) Going to auto-reconnect in %s seconds.', self.name, autoconnect)
time.sleep(autoconnect) time.sleep(autoconnect)
else: else:
log.info('(%s) Stopping connect loop (autoconnect value %r is < 1).', self.name, autoconnect)
return return
def callCommand(self, source, text): def callCommand(self, source, text):

View File

@ -74,7 +74,7 @@ servers:
# (omitting the .py extension). # (omitting the .py extension).
protocol: "inspircd" protocol: "inspircd"
# Sets autoconnect delay - comment this out or set the value negative to disable autoconnect entirely. # Sets autoconnect delay - comment this out or set the value below 1 to disable autoconnect entirely.
autoconnect: 5 autoconnect: 5
# Sets ping frequency (i.e. how long we should wait between sending pings to our uplink). # Sets ping frequency (i.e. how long we should wait between sending pings to our uplink).