lt sync 2744

This commit is contained in:
Andrew Resch 2008-09-30 22:37:50 +00:00
commit 7ed2d7c87a
6 changed files with 11 additions and 4 deletions

View file

@ -636,10 +636,11 @@ namespace libtorrent
TORRENT_ASSERT(j.buffer_size <= m_block_size); TORRENT_ASSERT(j.buffer_size <= m_block_size);
mutex_t::scoped_lock l(m_queue_mutex); mutex_t::scoped_lock l(m_queue_mutex);
#ifndef NDEBUG #ifndef NDEBUG
mutex_t::scoped_lock l2(m_piece_mutex);
if (j.action == disk_io_job::write) if (j.action == disk_io_job::write)
{ {
cache_t::iterator p cache_t::iterator p
= find_cached_piece(m_pieces, j, l); = find_cached_piece(m_pieces, j, l2);
if (p != m_pieces.end()) if (p != m_pieces.end())
{ {
int block = j.offset / m_block_size; int block = j.offset / m_block_size;

View file

@ -245,7 +245,7 @@ namespace libtorrent
std::string error_str("invalid bencoding of tracker response: \""); std::string error_str("invalid bencoding of tracker response: \"");
for (char const* i = data, *end(data + size); i != end; ++i) for (char const* i = data, *end(data + size); i != end; ++i)
{ {
if (std::isprint(*i)) error_str += *i; if (*i >= ' ' && *i <= '~') error_str += *i;
else error_str += "0x" + boost::lexical_cast<std::string>((unsigned int)*i) + " "; else error_str += "0x" + boost::lexical_cast<std::string>((unsigned int)*i) + " ";
} }
error_str += "\""; error_str += "\"";

View file

@ -1136,7 +1136,8 @@ namespace aux {
int free_slots = m_half_open.free_slots(); int free_slots = m_half_open.free_slots();
if (!m_torrents.empty() if (!m_torrents.empty()
&& free_slots > -m_half_open.limit() && free_slots > -m_half_open.limit()
&& num_connections() < m_max_connections) && num_connections() < m_max_connections
&& !m_abort)
{ {
// this is the maximum number of connections we will // this is the maximum number of connections we will
// attempt this tick // attempt this tick

View file

@ -58,6 +58,7 @@ POSSIBILITY OF SUCH DAMAGE.
#pragma warning(pop) #pragma warning(pop)
#endif #endif
#include "libtorrent/config.hpp"
#include "libtorrent/storage.hpp" #include "libtorrent/storage.hpp"
#include "libtorrent/torrent.hpp" #include "libtorrent/torrent.hpp"
#include "libtorrent/hasher.hpp" #include "libtorrent/hasher.hpp"

View file

@ -3053,7 +3053,8 @@ namespace libtorrent
{ {
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
INVARIANT_CHECK; // doesn't work with the m_paused -> m_num_peers == 0 condition
// INVARIANT_CHECK;
while (!m_connections.empty()) while (!m_connections.empty())
{ {
@ -3500,6 +3501,8 @@ namespace libtorrent
{ {
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
if (is_paused()) TORRENT_ASSERT(num_peers() == 0);
if (!m_ses.m_queued_for_checking.empty()) if (!m_ses.m_queued_for_checking.empty())
{ {
// if there are torrents waiting to be checked // if there are torrents waiting to be checked

View file

@ -111,6 +111,7 @@ void udp_socket::on_read(udp::socket* s, error_code const& e, std::size_t bytes_
s->async_receive_from(asio::buffer(m_v6_buf, sizeof(m_v6_buf)) s->async_receive_from(asio::buffer(m_v6_buf, sizeof(m_v6_buf))
, m_v6_ep, boost::bind(&udp_socket::on_read, this, s, _1, _2)); , m_v6_ep, boost::bind(&udp_socket::on_read, this, s, _1, _2));
++m_outstanding;
return; return;
} }