From 94ae0e433b378edbf64c529058082cfd2763da76 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 6 May 2012 07:09:49 +0000 Subject: [PATCH] fixed semantics of rate_limit_utp to also ignore per-torrent limits --- ChangeLog | 1 + src/peer_connection.cpp | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6bc87b7f4..71aa95f04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ + * fixed semantics of rate_limit_utp to also ignore per-torrent limits * fixed piece sorting bug of deadline pieces * fixed python binding build on Mac OS and BSD * fixed UNC path normalization (on windows, unless UNC paths are disabled) diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 4025310b5..fba8a6a5d 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -4746,15 +4746,16 @@ namespace libtorrent && t) { int ret = 0; - if (!m_ignore_bandwidth_limits) + bool utp = m_socket->get() != 0; + bool ignore_limits = m_ignore_bandwidth_limits + || (!m_ses.m_settings.rate_limit_utp && utp); + if (!ignore_limits) { - bool utp = m_socket->get() != 0; - // in this case, we have data to send, but no // bandwidth. So, we simply request bandwidth // from the bandwidth manager ret = request_upload_bandwidth( - (m_ses.m_settings.rate_limit_utp || !utp) ? &m_ses.m_upload_channel : 0 + &m_ses.m_upload_channel , &t->m_bandwidth_channel[upload_channel] , &m_bandwidth_channel[upload_channel] , !utp ? &m_ses.m_tcp_upload_channel : 0); @@ -4899,15 +4900,16 @@ namespace libtorrent && t) { int ret = 0; - if (!m_ignore_bandwidth_limits) + bool utp = m_socket->get() != 0; + bool ignore_limits = m_ignore_bandwidth_limits + || (!m_ses.m_settings.rate_limit_utp && utp); + if (!ignore_limits) { - bool utp = m_socket->get() != 0; - // in this case, we have outstanding data to // receive, but no bandwidth quota. So, we simply // request bandwidth from the bandwidth manager ret = request_download_bandwidth( - (m_ses.m_settings.rate_limit_utp || !utp) ? &m_ses.m_download_channel : 0 + &m_ses.m_download_channel , &t->m_bandwidth_channel[download_channel] , &m_bandwidth_channel[download_channel] , !utp ? &m_ses.m_tcp_download_channel : 0);