Skip to content

Commit cf155b9

Browse files
committed
Fix errors in irc client
1 parent e91f7aa commit cf155b9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

cloudbot/clients/irc.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def __init__(self, bot, name, nick, *, channels=None, config=None):
6868

6969
self.use_ssl = config['connection'].get('ssl', False)
7070
self._ignore_cert_errors = config['connection']['ignore_cert']
71-
self._timeout = config['connection']['timeout']
71+
self._timeout = config['connection'].get('timeout', 300)
7272
self.server = config['connection']['server']
7373
self.port = config['connection'].get('port', 6667)
7474

@@ -106,13 +106,13 @@ def describe_server(self):
106106
def try_connect(self):
107107
while True:
108108
try:
109-
yield from self.connect(self.timeout)
109+
yield from self.connect(self._timeout)
110110
except (asyncio.TimeoutError, OSError):
111111
logger.exception("[%s] Error occurred while connecting", self.name)
112112
else:
113113
break
114114

115-
yield from asyncio.sleep(random.randrange(self.timeout))
115+
yield from asyncio.sleep(random.randrange(self._timeout))
116116

117117
@asyncio.coroutine
118118
def connect(self, timeout=None):
@@ -380,7 +380,7 @@ def data_received(self, data):
380380
# Reply to pings immediately
381381

382382
if command == "PING":
383-
async_util.wrap_future(self.conn.send("PONG " + command_params[-1], log=False), loop=self.loop)
383+
self.conn.send("PONG " + command_params[-1], log=False)
384384

385385
# Parse the command and params
386386

0 commit comments

Comments
 (0)