From 2a6b019431a9b5133f9183bc7e4e50118b59ef8e Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sat, 17 Sep 2011 23:01:39 +0000 Subject: [PATCH] don't fail socks5 on 'socket already open' --- src/socks5_stream.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/socks5_stream.cpp b/src/socks5_stream.cpp index 3b4d5a1d4..58dfebcd4 100644 --- a/src/socks5_stream.cpp +++ b/src/socks5_stream.cpp @@ -80,12 +80,15 @@ namespace libtorrent } error_code ec; - m_sock.open(i->endpoint().protocol(), ec); - if (ec) + if (!m_sock.is_open()) { - (*h)(ec); - close(ec); - return; + m_sock.open(i->endpoint().protocol(), ec); + if (ec) + { + (*h)(ec); + close(ec); + return; + } } // TOOD: we could bind the socket here, since we know what the