mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 13:12:36 +01:00
networks.remote: break if the target network is the same as the source (#437)
_remote_reply() otherwise gets sent into a loop when remoteirc and irc is the same here.
This commit is contained in:
parent
490f21ff9f
commit
6c4e042307
@ -64,6 +64,13 @@ def remote(irc, source, args):
|
|||||||
|
|
||||||
args = remote_parser.parse_args(args)
|
args = remote_parser.parse_args(args)
|
||||||
netname = args.network
|
netname = args.network
|
||||||
|
|
||||||
|
if netname == irc.name:
|
||||||
|
# This would actually throw _remote_reply() into a loop, so check for it here...
|
||||||
|
# XXX: properly fix this.
|
||||||
|
irc.error("Cannot remote-send a command to the local network; use a normal command!")
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
remoteirc = world.networkobjects[netname]
|
remoteirc = world.networkobjects[netname]
|
||||||
except KeyError: # Unknown network.
|
except KeyError: # Unknown network.
|
||||||
@ -85,6 +92,9 @@ def remote(irc, source, args):
|
|||||||
"""
|
"""
|
||||||
reply() rerouter for the 'remote' command.
|
reply() rerouter for the 'remote' command.
|
||||||
"""
|
"""
|
||||||
|
assert irc.name != placeholder_self.name, \
|
||||||
|
"Refusing to route reply back to the same " \
|
||||||
|
"network, as this would cause a recursive loop"
|
||||||
log.debug('(%s) networks.remote: re-routing reply %r from network %s', irc.name,
|
log.debug('(%s) networks.remote: re-routing reply %r from network %s', irc.name,
|
||||||
text, placeholder_self.name)
|
text, placeholder_self.name)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user