Skip empty lines during name prompt and fix tintin send syntax

The server now skips spurious empty lines from client negotiation bytes
during the name prompt, only closing on actual connection loss. This
makes the login flow robust against clients that send IAC bytes with
trailing CRLF during negotiation.

Also fixed tintin++ CATCH handlers to use proper \} syntax matching the
documented examples.
This commit is contained in:
Jared Miller 2026-02-12 15:03:45 -05:00
parent aafdcdca42
commit bd5f83e890
Signed by: shmup
GPG key ID: 22B5C6D66A38B06C
2 changed files with 11 additions and 7 deletions

View file

@ -10,9 +10,9 @@
#NOP protocol negotiation: tintin++ does NOT auto-negotiate MSDP or
#NOP GMCP. CATCH intercepts before the default DONT response, and
#NOP #line raw bypasses IAC escaping so the DO bytes arrive intact.
#EVENT {CATCH IAC WILL GMCP} {#line raw #send {\xFF\xFD\xC9}}
#EVENT {CATCH IAC WILL MSDP} {#line raw #send {\xFF\xFD\x45}}
#NOP #send handles hex escapes natively (no raw option needed).
#EVENT {CATCH IAC WILL GMCP} {#send {\xFF\xFD\xC9\}}
#EVENT {CATCH IAC WILL MSDP} {#send {\xFF\xFD\x45\}}
#NOP store incoming MSDP variables and refresh status bar
#EVENT {IAC SB MSDP} {

View file

@ -256,10 +256,14 @@ async def shell(
_writer.write("What is your name? ")
await _writer.drain()
# Skip empty lines from client negotiation bytes, only close on actual disconnect
while True:
name_input = await readline2(_reader, _writer)
if name_input is None or not name_input.strip():
if name_input is None:
_writer.close()
return
if name_input.strip():
break
player_name = name_input.strip()