1
0

Fized issue with connection encountered on slow internet connections.

This commit is contained in:
Jon Michael Aanes 2019-03-08 14:30:38 +01:00
parent d1a9ed6bbe
commit 8d9ce1e410

View File

@ -154,11 +154,16 @@ let /* Parsing util */
, num_parameters = 2 }
end
function ping_respond () =
function wait_for_msg (cmd: string): message =
let var msg := read_next_message()
in if msg.command <> cmd
then wait_for_msg(cmd)
else msg
end
in if msg.command = "PING"
then send_msg(cmd1("PONG", msg.parameters[0]))
function ping_respond () =
let var msg := wait_for_msg("PING")
in send_msg(cmd1("PONG", msg.parameters[0]))
end
function quit(quit_msg: string) =
@ -212,14 +217,20 @@ let /* Parsing util */
; main_loop()
end
in /* Establish connection */
print("USER tiger-bot * * : yo\n")
in ()
/* Establish connection */
/* At this point, we can register */
; print("USER tiger-bot * * : yo\n")
; print("NICK bot-fucker\n")
; flush()
/* Respond to PING */
/* Wait for first PING, and respond to it */
; ping_respond()
/* Wait for 001; so we know that we have been connected and
* registered */
; have_registered := 1
; wait_for_msg("001")
/* Connect to channel and greet */
; send_msg(cmd1("JOIN", "#bot-test"))