mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-01-19 04:18:23 +01:00
Add debug messages for counting SockWrapper objects.
You can use this to confirm that a memory leak exists.
This commit is contained in:
parent
7354600849
commit
a497132c01
8
ssnet.py
8
ssnet.py
@ -75,8 +75,12 @@ def _try_peername(sock):
|
||||
return 'unknown'
|
||||
|
||||
|
||||
_swcount = 0
|
||||
class SockWrapper:
|
||||
def __init__(self, rsock, wsock, connect_to=None, peername=None):
|
||||
global _swcount
|
||||
_swcount += 1
|
||||
debug3('creating new SockWrapper (%d now exist\n)' % _swcount)
|
||||
self.exc = None
|
||||
self.rsock = rsock
|
||||
self.wsock = wsock
|
||||
@ -87,7 +91,9 @@ class SockWrapper:
|
||||
self.try_connect()
|
||||
|
||||
def __del__(self):
|
||||
debug1('%r: deleting\n' % self)
|
||||
global _swcount
|
||||
_swcount -= 1
|
||||
debug1('%r: deleting (%d remain)\n' % (self, _swcount))
|
||||
if self.exc:
|
||||
debug1('%r: error was: %r\n' % (self, self.exc))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user