3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

relay: restore checks for irc.connected/world.started to prevent server spawning from happening too quickly

This commit is contained in:
James Lu 2015-10-10 15:21:38 -07:00
parent ffce69060c
commit 07694ae642

View File

@ -32,6 +32,10 @@ relay_started = True
def initializeAll(irc): def initializeAll(irc):
"""Initializes all relay channels for the given IRC object.""" """Initializes all relay channels for the given IRC object."""
# Wait for all IRC objects to initialize first. This prevents
# relay servers from being spawned too early (before server authentication),
# which would break connections.
world.started.wait(2)
for chanpair, entrydata in db.items(): for chanpair, entrydata in db.items():
network, channel = chanpair network, channel = chanpair
initializeChannel(irc, channel) initializeChannel(irc, channel)
@ -164,6 +168,8 @@ def getPrefixModes(irc, remoteirc, channel, user, mlist=None):
def getRemoteSid(irc, remoteirc): def getRemoteSid(irc, remoteirc):
"""Gets the remote server SID representing remoteirc on irc, spawning """Gets the remote server SID representing remoteirc on irc, spawning
it if it doesn't exist.""" it if it doesn't exist."""
# Don't spawn servers too early.
irc.connected.wait(2)
try: try:
spawnservers = irc.conf['relay']['spawn_servers'] spawnservers = irc.conf['relay']['spawn_servers']
except KeyError: except KeyError: