2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-27 19:37:57 +00:00

Add a 'reopen' capability to client

If client wants to force a reconnection, they can send ctrl-e, c, o, just as in conserver.
This commit is contained in:
Jarrod Johnson 2014-08-28 13:58:31 -04:00
parent cb631ee40f
commit e9ac1617a8
3 changed files with 14 additions and 0 deletions

View File

@ -459,6 +459,10 @@ def conserver_command(filehandle, command):
if command[0] == '.':
print("disconnect]\r")
quitconfetty(fullexit=consoleonly)
elif command[0] == 'o':
tlvdata.send(session.connection, {'operation': 'reopen',
'path': currconsole})
print('reopen]\r')
elif command[0] == 'b':
tlvdata.send(session.connection, {'operation': 'break',
'path': currconsole})
@ -467,6 +471,7 @@ def conserver_command(filehandle, command):
print("help]\r")
print(". disconnect\r")
print("b break\r")
print("o reopen\r")
print("<cr> abort command\r")
elif command[0] == '\x0d':
print("ignored]\r")

View File

@ -286,6 +286,9 @@ class _ConsoleHandler(object):
logdata=username, ltype=log.DataTypes.event,
event=log.Events.clientdisconnect, eventdata=edata)
def reopen(self):
self._got_disconnected()
def _handle_console_output(self, data):
if type(data) == int:
if data == conapi.ConsoleEvent.Disconnect:
@ -440,6 +443,9 @@ class ConsoleSession(object):
def send_break(self):
self.conshdl.send_break()
def reopen(self):
self.conshdl.reopen()
def destroy(self):
_handled_consoles[self.ckey].detachuser(self.username)
_handled_consoles[self.ckey].unregister_rcpt(self.reghdl)

View File

@ -172,6 +172,9 @@ def process_request(connection, request, cfm, authdata, authname, skipauth):
elif data['operation'] == 'break':
consession.send_break()
continue
elif data['operation'] == 'reopen':
consession.reopen()
continue
else:
raise Exception("TODO")
if not data: