From 834873a15efe09be6a3c9e0eafec3573021e73cf Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 17 Aug 2007 03:43:26 +0000 Subject: [PATCH] fixed unlimited settings check --- src/session_impl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 8c978a754..2110e88a4 100755 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1961,6 +1961,7 @@ namespace detail { assert(limit > 0 || limit == -1); mutex_t::scoped_lock l(m_mutex); + if (limit <= 0) limit = std::numeric_limits::max(); m_max_uploads = limit; } @@ -1968,6 +1969,7 @@ namespace detail { assert(limit > 0 || limit == -1); mutex_t::scoped_lock l(m_mutex); + if (limit <= 0) limit = std::numeric_limits::max(); m_max_connections = limit; } @@ -1975,7 +1977,7 @@ namespace detail { assert(limit > 0 || limit == -1); mutex_t::scoped_lock l(m_mutex); - + if (limit <= 0) limit = std::numeric_limits::max(); m_half_open.limit(limit); } @@ -1983,7 +1985,7 @@ namespace detail { assert(bytes_per_second > 0 || bytes_per_second == -1); mutex_t::scoped_lock l(m_mutex); - if (bytes_per_second == -1) bytes_per_second = bandwidth_limit::inf; + if (bytes_per_second <= 0) bytes_per_second = bandwidth_limit::inf; m_bandwidth_manager[peer_connection::download_channel]->throttle(bytes_per_second); } @@ -1991,7 +1993,7 @@ namespace detail { assert(bytes_per_second > 0 || bytes_per_second == -1); mutex_t::scoped_lock l(m_mutex); - if (bytes_per_second == -1) bytes_per_second = bandwidth_limit::inf; + if (bytes_per_second <= 0) bytes_per_second = bandwidth_limit::inf; m_bandwidth_manager[peer_connection::upload_channel]->throttle(bytes_per_second); }