diff options
author | waechtjn <Jan_Waechter@gmx.de> | 2014-01-26 16:53:53 +0100 |
---|---|---|
committer | waechtjn <Jan_Waechter@gmx.de> | 2014-01-26 16:53:53 +0100 |
commit | f76524fc9f6724c1013cd1d994dd7da813d8d61c (patch) | |
tree | 339bcfc98642c5dbcd2e15508f48f4484d30ea55 /sleekxmpp/plugins | |
parent | b95532b68b33787deef606e3ffc13e7416858b28 (diff) | |
download | slixmpp-f76524fc9f6724c1013cd1d994dd7da813d8d61c.tar.gz slixmpp-f76524fc9f6724c1013cd1d994dd7da813d8d61c.tar.bz2 slixmpp-f76524fc9f6724c1013cd1d994dd7da813d8d61c.tar.xz slixmpp-f76524fc9f6724c1013cd1d994dd7da813d8d61c.zip |
Fixed XEP-0065 SOCKS5 socket closing
SCOKS5 SID were removed multiple times from the _sessions dictionary
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r-- | sleekxmpp/plugins/xep_0065/proxy.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0065/proxy.py b/sleekxmpp/plugins/xep_0065/proxy.py index eba7d1e9..fdd9f97e 100644 --- a/sleekxmpp/plugins/xep_0065/proxy.py +++ b/sleekxmpp/plugins/xep_0065/proxy.py @@ -199,11 +199,16 @@ class XEP_0065(base_plugin): sock = self._sessions.get(sid) if sock: try: + # sock.close() will also delete sid from self._sessions (see _connect_proxy) sock.close() except socket.error: pass + # Though this should not be neccessary remove the closed session anyway 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): """Closes all proxy sockets.""" @@ -251,6 +256,7 @@ class XEP_0065(base_plugin): if sid in self._sessions: del self._sessions[sid] _close() + log.info('Socket closed.') sock.close = close sock.peer_jid = peer |