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:
parent
aafdcdca42
commit
bd5f83e890
2 changed files with 11 additions and 7 deletions
6
mud.tin
6
mud.tin
|
|
@ -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} {
|
||||
|
|
|
|||
|
|
@ -256,10 +256,14 @@ async def shell(
|
|||
_writer.write("What is your name? ")
|
||||
await _writer.drain()
|
||||
|
||||
name_input = await readline2(_reader, _writer)
|
||||
if name_input is None or not name_input.strip():
|
||||
_writer.close()
|
||||
return
|
||||
# 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:
|
||||
_writer.close()
|
||||
return
|
||||
if name_input.strip():
|
||||
break
|
||||
|
||||
player_name = name_input.strip()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue