cli: fix logic for closing connections

parent 58102751
...@@ -57,6 +57,8 @@ class OauTest(cmd.Cmd): ...@@ -57,6 +57,8 @@ class OauTest(cmd.Cmd):
if err < 0: if err < 0:
print('could not close fd {}'.format(self.fd)) print('could not close fd {}'.format(self.fd))
return return
self.fd = None
self.nchannels = None
def read_nchannels(self): def read_nchannels(self):
err = self.api.oau_att_get_nchannels(self.fd) err = self.api.oau_att_get_nchannels(self.fd)
...@@ -67,6 +69,9 @@ class OauTest(cmd.Cmd): ...@@ -67,6 +69,9 @@ class OauTest(cmd.Cmd):
def do_nchannels(self, arg): def do_nchannels(self, arg):
"""number of channels of current device.""" """number of channels of current device."""
if self.nchannels is None:
print('no active connection')
return
print('{} channels'.format(self.nchannels)) print('{} channels'.format(self.nchannels))
def do_get_attn(self, arg): def do_get_attn(self, arg):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment