mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Silence errors in Socket driver if connecting failed (name resolution, ...).
This commit is contained in:
parent
9288b16cd2
commit
573d4a0158
@ -126,6 +126,8 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
self.eagains += 1
|
self.eagains += 1
|
||||||
|
|
||||||
def _sendIfMsgs(self):
|
def _sendIfMsgs(self):
|
||||||
|
if not self.connected:
|
||||||
|
return
|
||||||
if not self.zombie:
|
if not self.zombie:
|
||||||
msgs = [self.irc.takeMsg()]
|
msgs = [self.irc.takeMsg()]
|
||||||
while msgs[-1] is not None:
|
while msgs[-1] is not None:
|
||||||
@ -154,7 +156,8 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
for inst in cls._instances:
|
for inst in cls._instances:
|
||||||
# Do not use a list comprehension here, we have to edit the list
|
# Do not use a list comprehension here, we have to edit the list
|
||||||
# and not to reassign it.
|
# and not to reassign it.
|
||||||
if (sys.version_info[0] == 3 and inst.conn._closed) or \
|
if not inst.connected or \
|
||||||
|
(sys.version_info[0] == 3 and inst.conn._closed) or \
|
||||||
(sys.version_info[0] == 2 and
|
(sys.version_info[0] == 2 and
|
||||||
inst.conn._sock.__class__ is socket._closedsocket):
|
inst.conn._sock.__class__ is socket._closedsocket):
|
||||||
cls._instances.remove(inst)
|
cls._instances.remove(inst)
|
||||||
@ -264,8 +267,13 @@ class SocketDriver(drivers.IrcDriver, drivers.ServersMixin):
|
|||||||
else:
|
else:
|
||||||
drivers.log.debug('Not resetting %s.', self.irc)
|
drivers.log.debug('Not resetting %s.', self.irc)
|
||||||
server = self._getNextServer()
|
server = self._getNextServer()
|
||||||
address = utils.net.getAddressFromHostname(server[0],
|
try:
|
||||||
attempt=self._attempt)
|
address = utils.net.getAddressFromHostname(server[0],
|
||||||
|
attempt=self._attempt)
|
||||||
|
except socket.gaierror as e:
|
||||||
|
drivers.log.connectError(self.currentServer, e)
|
||||||
|
self.scheduleReconnect()
|
||||||
|
return
|
||||||
drivers.log.connect(self.currentServer)
|
drivers.log.connect(self.currentServer)
|
||||||
try:
|
try:
|
||||||
socks_proxy = getattr(conf.supybot.networks, self.irc.network) \
|
socks_proxy = getattr(conf.supybot.networks, self.irc.network) \
|
||||||
|
Loading…
Reference in New Issue
Block a user