From 8f030fb1120ece5d81a7c0a7dd24b4ca5b017039 Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 15 Oct 2007 19:34:24 +0000 Subject: fixed issue with failing async_accept on windows --- libtorrent/src/session_impl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libtorrent/src/session_impl.cpp b/libtorrent/src/session_impl.cpp index 63c039010..a602c6fa4 100755 --- a/libtorrent/src/session_impl.cpp +++ b/libtorrent/src/session_impl.cpp @@ -89,6 +89,10 @@ namespace } openssl_global_destructor; } +#endif +#ifdef _WIN32 +// for ERROR_SEM_TIMEOUT +#include #endif using boost::shared_ptr; @@ -924,6 +928,15 @@ namespace detail std::string msg = "error accepting connection on '" + boost::lexical_cast(ep) + "' " + e.message(); (*m_logger) << msg << "\n"; +#endif +#ifdef _WIN32 + // Windows sometimes generates this error. It seems to be + // non-fatal and we have to do another async_accept. + if (e.value() == ERROR_SEM_TIMEOUT) + { + async_accept(listener); + return; + } #endif if (m_alerts.should_post(alert::fatal)) { -- cgit