mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
If you type reload inside iou you are no longer disconnected
This commit is contained in:
parent
29e8d91745
commit
5e59145948
@ -159,10 +159,6 @@ class Console:
|
|||||||
raise NotImplementedError("Only routers have fileno()")
|
raise NotImplementedError("Only routers have fileno()")
|
||||||
|
|
||||||
|
|
||||||
class Router:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class TTY(Console):
|
class TTY(Console):
|
||||||
|
|
||||||
def read(self, fileno, bufsize):
|
def read(self, fileno, bufsize):
|
||||||
@ -370,7 +366,7 @@ class TelnetServer(Console):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class IOU(Router):
|
class IOU:
|
||||||
|
|
||||||
def __init__(self, ttyC, ttyS, stop_event):
|
def __init__(self, ttyC, ttyS, stop_event):
|
||||||
self.ttyC = ttyC
|
self.ttyC = ttyC
|
||||||
@ -616,8 +612,13 @@ def start_ioucon(cmdline_args, stop_event):
|
|||||||
try:
|
try:
|
||||||
if args.telnet_server:
|
if args.telnet_server:
|
||||||
with TelnetServer(addr, nport, stop_event) as console:
|
with TelnetServer(addr, nport, stop_event) as console:
|
||||||
with IOU(ttyC, ttyS, stop_event) as router:
|
# We loop inside the Telnet server otherwise the client is disconnected when user use the reload command inside a terminal
|
||||||
send_recv_loop(console, router, b'', stop_event)
|
while not stop_event.is_set():
|
||||||
|
try:
|
||||||
|
with IOU(ttyC, ttyS, stop_event) as router:
|
||||||
|
send_recv_loop(console, router, b'', stop_event)
|
||||||
|
except ConnectionRefusedError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
with IOU(ttyC, ttyS, stop_event) as router, TTY() as console:
|
with IOU(ttyC, ttyS, stop_event) as router, TTY() as console:
|
||||||
send_recv_loop(console, router, esc_char, stop_event)
|
send_recv_loop(console, router, esc_char, stop_event)
|
||||||
|
Loading…
Reference in New Issue
Block a user