SEDbgMuxApp: add a command for terminating connections

This commit is contained in:
Vadim Yanitskiy 2022-06-26 00:19:40 +07:00
parent c81e0e2ad8
commit dbb66828ef
1 changed files with 12 additions and 0 deletions

View File

@ -192,6 +192,18 @@ class SEDbgMuxApp(cmd2.Cmd):
self.peer.disp.register(ch)
ch.establish(opts.DPRef)
terminate_parser = cmd2.Cmd2ArgumentParser()
terminate_parser.add_argument('ConnRef',
type=lambda v: int(v, 16),
help='ConnRef in hex')
@cmd2.with_argparser(terminate_parser)
@cmd2.with_category(CATEGORY_DBGMUX)
def do_terminate(self, opts) -> None:
''' Terminate connection with a Data Provider '''
msg = dict(ConnRef=opts.ConnRef)
self.peer.send(DbgMuxFrame.MsgType.ConnTerminate, msg)
ap = argparse.ArgumentParser(prog='sedbgmux', description=SEDbgMuxApp.DESC,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)