Browse Source

add function to clear the handler..

main
John-Mark Gurney 4 years ago
parent
commit
45731959b6
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      wsfwd/__init__.py

+ 10
- 0
wsfwd/__init__.py View File

@@ -222,6 +222,13 @@ class WSFWDCommon:
# XXX - make sure we don't overwrite an existing one
self._procmsgs[stream] = hndlr

def clear_stream_handler(self, stream):
'''
Clear the handler for stream.
'''

del self._procmsgs[stream]

async def _process_msgs(self):
'''
Internal routine to dispatch messages received via
@@ -625,6 +632,9 @@ class Test(unittest.IsolatedAsyncioTestCase):
await self.drain(stream)

async def handle_exec(self, msg):
self.add_stream_handler(msg['stdin'], None)
self.clear_stream_handler(msg['stdin'])
assert msg['stdin'] not in self._procmsgs
self.add_stream_handler(msg['stdin'],
functools.partial(self.echo_handler,
msg['stdout']))


Loading…
Cancel
Save