From d2b37572fa0880bc03e1632404642fb3e0aa2da0 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 3 Jul 2008 10:05:19 +0000 Subject: [PATCH] disable endpoint sorting in http_connection for msvc, since it ICEs the compiler. Fixes #361 --- src/http_connection.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/http_connection.cpp b/src/http_connection.cpp index 183c60e97..5158796b6 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -271,12 +271,16 @@ void http_connection::on_resolve(error_code const& e std::transform(i, tcp::resolver::iterator(), std::back_inserter(m_endpoints) , boost::bind(&tcp::resolver::iterator::value_type::endpoint, _1)); + // The following statement causes msvc to crash (ICE). Since it's not + // necessary in the vast majority of cases, just ignore the endpoint + // order for windows +#if !defined _MSC_VER || _MSC_VER > 1310 // sort the endpoints so that the ones with the same IP version as our // bound listen socket are first. So that when contacting a tracker, // we'll talk to it from the same IP that we're listening on - m_endpoints.sort( - (bind(&address::is_v4, bind(&tcp::endpoint::address, _1)) == m_bind_addr.is_v4()) - > (bind(&address::is_v4, bind(&tcp::endpoint::address, _2)) == m_bind_addr.is_v4())); + std::partition(m_endpoints.begin(), m_endpoints.end() + , boost::bind(&address::is_v4, boost::bind(&tcp::endpoint::address, _1)) == m_bind_addr.is_v4()); +#endif queue_connect(); }