mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 09:19:23 +01:00
protocols: move handle_pong into ircs2s_common, be less strict about the ping argument
This fixes issues on UnrealIRCd where PONGs get ignored if the argument doesn't match the server name entirely (e.g. different case).
Treating all PONGs from the uplink as valid is totally fine, as all we care about is that the uplink is alive.
(cherry picked from commit 38350465c1
)
This commit is contained in:
parent
930443f4cd
commit
d5eb01b724
@ -508,15 +508,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
if self.irc.isInternalServer(args[1]):
|
||||
self._send(args[1], 'PONG %s %s' % (args[1], source))
|
||||
|
||||
def handle_pong(self, source, command, args):
|
||||
"""Handles incoming PONG commands.
|
||||
|
||||
This is used to keep track of whether the uplink is alive by the Irc()
|
||||
internals - a server that fails to reply to our PINGs eventually
|
||||
times out and is disconnected."""
|
||||
if source == self.irc.uplink and args[1] == self.irc.sid:
|
||||
self.irc.lastping = time.time()
|
||||
|
||||
def handle_fjoin(self, servernumeric, command, args):
|
||||
"""Handles incoming FJOIN commands (InspIRCd equivalent of JOIN/SJOIN)."""
|
||||
# :70M FJOIN #chat 1423790411 +AFPfjnt 6:5 7:5 9:5 :o,1SRAABIT4 v,1IOAAF53R <...>
|
||||
|
@ -98,3 +98,8 @@ class IRCS2SProtocol(Protocol):
|
||||
def handle_time(self, numeric, command, args):
|
||||
"""Handles incoming /TIME requests."""
|
||||
return {'target': args[0]}
|
||||
|
||||
def handle_pong(self, source, command, args):
|
||||
"""Handles incoming PONG commands."""
|
||||
if source == self.irc.uplink:
|
||||
self.irc.lastping = time.time()
|
||||
|
@ -966,12 +966,6 @@ class P10Protocol(IRCS2SProtocol):
|
||||
if args[0] != self.irc.serverdata['recvpass']:
|
||||
raise ProtocolError("Error: RECVPASS from uplink does not match configuration!")
|
||||
|
||||
def handle_pong(self, source, command, args):
|
||||
"""Handles incoming PONGs."""
|
||||
# <- AB Z AB :Ay
|
||||
if source == self.irc.uplink:
|
||||
self.irc.lastping = time.time()
|
||||
|
||||
def handle_burst(self, source, command, args):
|
||||
"""Handles the BURST command, used for bursting channels on link.
|
||||
|
||||
|
@ -411,12 +411,6 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
# Return the endburst hook.
|
||||
return {'parse_as': 'ENDBURST'}
|
||||
|
||||
|
||||
def handle_pong(self, source, command, args):
|
||||
"""Handles incoming PONG commands."""
|
||||
if source == self.irc.uplink:
|
||||
self.irc.lastping = time.time()
|
||||
|
||||
def handle_sjoin(self, servernumeric, command, args):
|
||||
"""Handles incoming SJOIN commands."""
|
||||
# parameters: channelTS, channel, simple modes, opt. mode parameters..., nicklist
|
||||
|
@ -404,12 +404,6 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
if numeric == self.irc.uplink:
|
||||
self.irc.send('PONG %s :%s' % (self.irc.serverdata['hostname'], args[-1]))
|
||||
|
||||
def handle_pong(self, source, command, args):
|
||||
log.debug('(%s) Ping received from %s for %s.', self.irc.name, source, args[-1])
|
||||
if source in (self.irc.uplink, self.irc.servers[self.irc.uplink].name) and args[-1] == self.irc.serverdata['hostname']:
|
||||
log.debug('(%s) Set self.irc.lastping.', self.irc.name)
|
||||
self.irc.lastping = time.time()
|
||||
|
||||
def handle_server(self, numeric, command, args):
|
||||
"""Handles the SERVER command, which is used for both authentication and
|
||||
introducing legacy (non-SID) servers."""
|
||||
|
Loading…
Reference in New Issue
Block a user