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