diff options
author | Lance Stout <lancestout@gmail.com> | 2014-02-03 19:19:15 -0600 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2014-02-03 19:19:15 -0600 |
commit | d9db1b84fe03ff92653afede1c2f1da4f0868fe4 (patch) | |
tree | 81e477cef6daeaafdedad09ad5a5a9db7c3e15e4 /sleekxmpp/plugins/xep_0065/proxy.py | |
parent | bd03f071c611225984223c6d942cab49b46bfcc8 (diff) | |
parent | 848e6ebd8329b8e3fec4d770794361b39d2aaa69 (diff) | |
download | slixmpp-d9db1b84fe03ff92653afede1c2f1da4f0868fe4.tar.gz slixmpp-d9db1b84fe03ff92653afede1c2f1da4f0868fe4.tar.bz2 slixmpp-d9db1b84fe03ff92653afede1c2f1da4f0868fe4.tar.xz slixmpp-d9db1b84fe03ff92653afede1c2f1da4f0868fe4.zip |
Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0065/proxy.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0065/proxy.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0065/proxy.py b/sleekxmpp/plugins/xep_0065/proxy.py index 265d3030..fdd9f97e 100644 --- a/sleekxmpp/plugins/xep_0065/proxy.py +++ b/sleekxmpp/plugins/xep_0065/proxy.py @@ -88,8 +88,9 @@ class XEP_0065(base_plugin): # Request that the proxy activate the session with the target. self.activate(proxy, sid, to, timeout=timeout) - self.xmpp.event('stream:%s:%s' % (sid, conn.peer_jid), conn) - return self.get_socket(sid) + socket = self.get_socket(sid) + self.xmpp.event('stream:%s:%s' % (sid, to), socket) + return socket def request_stream(self, to, sid=None, ifrom=None, block=True, timeout=None, callback=None): if sid is None: @@ -198,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.""" @@ -250,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 |