Don't try to SEL a nonexistent session
This commit is contained in:
parent
a073d9a5d4
commit
555c7e90f4
1 changed files with 11 additions and 8 deletions
19
server.py
19
server.py
|
@ -371,15 +371,18 @@ async def telnet_server(
|
||||||
else:
|
else:
|
||||||
writer.write("WONT\r\n".encode("utf-8"))
|
writer.write("WONT\r\n".encode("utf-8"))
|
||||||
else:
|
else:
|
||||||
session = active_sessions[sid]
|
if sid not in active_sessions:
|
||||||
if session is None:
|
writer.write("WONT\r\n".encode("utf-8"))
|
||||||
writer.write("FAIL\r\n".encode("utf-8"))
|
|
||||||
else:
|
else:
|
||||||
if live_session is not None:
|
session = active_sessions[sid]
|
||||||
await live_session.end()
|
if session is None:
|
||||||
asyncio.ensure_future(session.activate())
|
writer.write("FAIL\r\n".encode("utf-8"))
|
||||||
live_session = session
|
else:
|
||||||
writer.write("OKAY\r\n".encode("utf-8"))
|
if live_session is not None:
|
||||||
|
await live_session.end()
|
||||||
|
asyncio.ensure_future(session.activate())
|
||||||
|
live_session = session
|
||||||
|
writer.write("OKAY\r\n".encode("utf-8"))
|
||||||
else:
|
else:
|
||||||
writer.write("WHAT\r\n".encode("utf-8"))
|
writer.write("WHAT\r\n".encode("utf-8"))
|
||||||
await writer.drain()
|
await writer.drain()
|
||||||
|
|
Loading…
Reference in a new issue