mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
relay: don't allow linking to channels when the home network is down
This check can be overridden via --force, and should stop unreliable TS checks from appearing instead Closes #419.
This commit is contained in:
parent
93c9b6289c
commit
f432f6f082
@ -1745,6 +1745,13 @@ def link(irc, source, args):
|
||||
log.info("(%s) relay: Forcing link %s%s -> %s%s", irc.name, irc.name, localchan, remotenet,
|
||||
args.channel)
|
||||
else:
|
||||
if not world.networkobjects[remotenet].connected.is_set():
|
||||
log.debug('(%s) relay: Blocking link request %s%s -> %s%s because the target '
|
||||
'network is down', irc.name, irc.name, localchan, remotenet, args.channel)
|
||||
irc.error("The target network %s is not connected; refusing to link (you may be "
|
||||
"able to override this with the --force option)." % remotenet)
|
||||
return
|
||||
|
||||
our_ts = irc.channels[localchan].ts
|
||||
their_ts = world.networkobjects[remotenet].channels[args.channel].ts
|
||||
if (our_ts < their_ts) and irc.protoname != 'clientbot':
|
||||
@ -1752,7 +1759,8 @@ def link(irc, source, args):
|
||||
irc.name, localchan, remotenet, args.channel, our_ts, their_ts)
|
||||
irc.error("The channel creation date (TS) on %s (%s) is lower than the target "
|
||||
"channel's (%s); refusing to link. You should clear the local channel %s first "
|
||||
"before linking, or use a different local channel." % (localchan, our_ts, their_ts, localchan))
|
||||
"before linking, or use a different local channel (you may be able to "
|
||||
"override this with the --force option)." % (localchan, our_ts, their_ts, localchan))
|
||||
return
|
||||
|
||||
entry['links'].add((irc.name, localchan))
|
||||
|
Loading…
Reference in New Issue
Block a user