Fixed XEP-0065 SOCKS5 socket closing
SCOKS5 SID were removed multiple times from the _sessions dictionary
This commit is contained in:
parent
b95532b68b
commit
f76524fc9f
1 changed files with 7 additions and 1 deletions
|
@ -199,11 +199,16 @@ class XEP_0065(base_plugin):
|
||||||
sock = self._sessions.get(sid)
|
sock = self._sessions.get(sid)
|
||||||
if sock:
|
if sock:
|
||||||
try:
|
try:
|
||||||
|
# sock.close() will also delete sid from self._sessions (see _connect_proxy)
|
||||||
sock.close()
|
sock.close()
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
# Though this should not be neccessary remove the closed session anyway
|
||||||
with self._sessions_lock:
|
with self._sessions_lock:
|
||||||
del self._sessions[sid]
|
if sid in self._sessions:
|
||||||
|
log.warn(('SOCKS5 session with sid = "%s" was not ' +
|
||||||
|
'removed from _sessions by sock.close()') % sid)
|
||||||
|
del self._sessions[sid]
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
"""Closes all proxy sockets."""
|
"""Closes all proxy sockets."""
|
||||||
|
@ -251,6 +256,7 @@ class XEP_0065(base_plugin):
|
||||||
if sid in self._sessions:
|
if sid in self._sessions:
|
||||||
del self._sessions[sid]
|
del self._sessions[sid]
|
||||||
_close()
|
_close()
|
||||||
|
log.info('Socket closed.')
|
||||||
sock.close = close
|
sock.close = close
|
||||||
|
|
||||||
sock.peer_jid = peer
|
sock.peer_jid = peer
|
||||||
|
|
Loading…
Reference in a new issue