mirror of https://github.com/Mikaela/Limnoria.git
Who would've thunk ya needed utils
This commit is contained in:
parent
847227622f
commit
fefe1f2806
|
@ -47,6 +47,7 @@ from itertools import imap
|
||||||
|
|
||||||
import log
|
import log
|
||||||
import conf
|
import conf
|
||||||
|
import utils
|
||||||
import world
|
import world
|
||||||
import drivers
|
import drivers
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
|
@ -96,7 +97,7 @@ class SocketDriver(drivers.IrcDriver):
|
||||||
else:
|
else:
|
||||||
log.debug('Got EAGAIN, current count: %s', self.eagains)
|
log.debug('Got EAGAIN, current count: %s', self.eagains)
|
||||||
self.eagains += 1
|
self.eagains += 1
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
# We sleep here because otherwise, if we're the only driver, we'll
|
# We sleep here because otherwise, if we're the only driver, we'll
|
||||||
|
@ -126,7 +127,7 @@ class SocketDriver(drivers.IrcDriver):
|
||||||
self.eagains += 1
|
self.eagains += 1
|
||||||
return
|
return
|
||||||
self._sendIfMsgs()
|
self._sendIfMsgs()
|
||||||
|
|
||||||
def reconnect(self, wait=False):
|
def reconnect(self, wait=False):
|
||||||
if self.connected:
|
if self.connected:
|
||||||
log.info('Reconnect called on driver for %s.' % self.irc)
|
log.info('Reconnect called on driver for %s.' % self.irc)
|
||||||
|
@ -167,7 +168,7 @@ class SocketDriver(drivers.IrcDriver):
|
||||||
return
|
return
|
||||||
self.connected = True
|
self.connected = True
|
||||||
self.reconnectWaitPeriodsIndex = 0
|
self.reconnectWaitPeriodsIndex = 0
|
||||||
|
|
||||||
def _checkAndWriteOrReconnect(self):
|
def _checkAndWriteOrReconnect(self):
|
||||||
log.debug('Checking whether we are connected.')
|
log.debug('Checking whether we are connected.')
|
||||||
(_, w, _) = select.select([], [self.conn], [], 0)
|
(_, w, _) = select.select([], [self.conn], [], 0)
|
||||||
|
@ -178,7 +179,7 @@ class SocketDriver(drivers.IrcDriver):
|
||||||
else:
|
else:
|
||||||
log.warning('Error connecting to %s: Timed out.', self.server[0])
|
log.warning('Error connecting to %s: Timed out.', self.server[0])
|
||||||
self.reconnect()
|
self.reconnect()
|
||||||
|
|
||||||
def _scheduleReconnect(self):
|
def _scheduleReconnect(self):
|
||||||
when = time.time() + self.reconnectWaits[self.reconnectWaitsIndex]
|
when = time.time() + self.reconnectWaits[self.reconnectWaitsIndex]
|
||||||
if not world.dying:
|
if not world.dying:
|
||||||
|
|
Loading…
Reference in New Issue