From 68cf2733d966132ca27c9678aa2a4bc043e6164e Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Sat, 25 Mar 2017 13:08:50 +0100 Subject: [PATCH] improve rpyc connection cleanup --- pupy/pp.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pupy/pp.py b/pupy/pp.py index 71a49ba3..62af6b9c 100755 --- a/pupy/pp.py +++ b/pupy/pp.py @@ -74,7 +74,7 @@ except ImportError: except Exception as e: logging.warning(e) -logging.getLogger().setLevel(logging.WARNING) +logging.getLogger().setLevel(logging.DEBUG) try: import pupy @@ -339,6 +339,7 @@ def rpyc_loop(launcher): global attempt global debug + stream=None for ret in launcher.iterate(): try: if isinstance(ret, tuple): # bind payload @@ -400,6 +401,12 @@ def rpyc_loop(launcher): logging.exception(e) except: print "Exception ({}): {}".format(type(e), e) + finally: + if stream is not None: + try: + stream.close() + except: + pass if __name__ == "__main__": main()