mirror of
https://github.com/progval/irctest.git
synced 2025-04-05 06:49:47 +00:00
Fix a bunch of synchronization heuristics to work with Sable (#236)
This commit is contained in:
@ -289,7 +289,7 @@ class BaseServerController(_BaseController):
|
||||
time.sleep(0.01)
|
||||
|
||||
c.send(b" ") # Triggers BrokenPipeError
|
||||
except BrokenPipeError:
|
||||
except (BrokenPipeError, ConnectionResetError):
|
||||
# ircu2 cuts the connection without a message if registration
|
||||
# is not complete.
|
||||
pass
|
||||
@ -344,13 +344,16 @@ class BaseServicesController(_BaseController):
|
||||
c.sendLine("NICK chkNS")
|
||||
c.sendLine("USER chk chk chk chk")
|
||||
time.sleep(self.server_controller.sync_sleep_time)
|
||||
for msg in c.getMessages(synchronize=False):
|
||||
if msg.command == "PING":
|
||||
# Hi Unreal
|
||||
c.sendLine("PONG :" + msg.params[0])
|
||||
c.getMessages()
|
||||
got_end_of_motd = False
|
||||
while not got_end_of_motd:
|
||||
for msg in c.getMessages(synchronize=False):
|
||||
if msg.command == "PING":
|
||||
# Hi Unreal
|
||||
c.sendLine("PONG :" + msg.params[0])
|
||||
if msg.command in ("376", "422"): # RPL_ENDOFMOTD / ERR_NOMOTD
|
||||
got_end_of_motd = True
|
||||
|
||||
timeout = time.time() + 3
|
||||
timeout = time.time() + 10
|
||||
while True:
|
||||
c.sendLine(f"PRIVMSG {self.server_controller.nickserv} :help")
|
||||
|
||||
@ -359,11 +362,17 @@ class BaseServicesController(_BaseController):
|
||||
if msg.command == "401":
|
||||
# NickServ not available yet
|
||||
pass
|
||||
elif msg.command in ("MODE", "221"): # RPL_UMODEIS
|
||||
pass
|
||||
elif msg.command == "NOTICE":
|
||||
# NickServ is available
|
||||
assert "nickserv" in (msg.prefix or "").lower(), msg
|
||||
print("breaking")
|
||||
break
|
||||
assert msg.prefix is not None
|
||||
if "!" not in msg.prefix and "." in msg.prefix:
|
||||
# Server notice
|
||||
pass
|
||||
else:
|
||||
# NickServ is available
|
||||
assert "nickserv" in (msg.prefix or "").lower(), msg
|
||||
break
|
||||
else:
|
||||
assert False, f"unexpected reply from NickServ: {msg}"
|
||||
else:
|
||||
|
Reference in New Issue
Block a user