From 6f127dd07b02b91c388f26347b3c5da5c2689947 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 1 May 2011 19:28:13 +0000 Subject: [PATCH] fixed build with no deprecated functions --- src/torrent.cpp | 8 ++++---- test/test_dht.cpp | 6 ++++-- test/test_web_seed.cpp | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/torrent.cpp b/src/torrent.cpp index c3bac3e59..3732a5be2 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -3882,7 +3882,7 @@ namespace libtorrent if (web->resolving) return; if (int(m_connections.size()) >= m_max_connections - || m_ses.num_connections() >= m_ses.max_connections()) + || m_ses.num_connections() >= m_ses.settings().connections_limit) return; #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING @@ -4028,7 +4028,7 @@ namespace libtorrent if (m_ses.is_aborted()) return; if (int(m_connections.size()) >= m_max_connections - || m_ses.num_connections() >= m_ses.max_connections()) + || m_ses.num_connections() >= m_ses.settings().connections_limit) return; tcp::endpoint a(host->endpoint()); @@ -4103,7 +4103,7 @@ namespace libtorrent } if (int(m_connections.size()) >= m_max_connections - || m_ses.num_connections() >= m_ses.max_connections()) + || m_ses.num_connections() >= m_ses.settings().connections_limit) return; tcp::endpoint a(host->endpoint()); @@ -6636,7 +6636,7 @@ namespace libtorrent // if we have everything we want we don't need to connect to any web-seed if (!is_finished() && !m_web_seeds.empty() && m_files_checked && int(m_connections.size()) < m_max_connections - && int(m_ses.m_connections.size()) < m_ses.max_connections()) + && m_ses.num_connections() < m_ses.settings().connections_limit) return; { diff --git a/test/test_dht.cpp b/test/test_dht.cpp index 07c87ecd9..38e46aac7 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -101,7 +101,10 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep // std::cerr << "sending: " << e << "\n"; lazy_entry decoded; - lazy_bdecode(msg_buf, msg_buf + size, decoded); + error_code ec; + lazy_bdecode(msg_buf, msg_buf + size, decoded, ec); + if (ec) fprintf(stderr, "lazy_bdecode failed: %s\n", ec.message().c_str()); + dht::msg m(decoded, ep); node.incoming(m); @@ -120,7 +123,6 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep static char inbuf[1500]; int len = bencode(inbuf, i->second); g_responses.erase(i); - error_code ec; int ret = lazy_bdecode(inbuf, inbuf + len, *reply, ec); TEST_CHECK(ret == 0); } diff --git a/test/test_web_seed.cpp b/test/test_web_seed.cpp index 58f6f6924..61d3515a4 100644 --- a/test/test_web_seed.cpp +++ b/test/test_web_seed.cpp @@ -57,8 +57,10 @@ void test_transfer(boost::intrusive_ptr torrent_file settings.max_queued_disk_bytes = 256 * 1024; ses.set_settings(settings); ses.set_alert_mask(~(alert::progress_notification | alert::stats_notification)); - ses.listen_on(std::make_pair(51000, 52000)); error_code ec; + ses.listen_on(std::make_pair(51000, 52000), ec); + if (ec) fprintf(stderr, "listen_on failed: %s\n", ec.message().c_str()); + remove_all("./tmp2_web_seed", ec); char const* test_name[] = {"no", "SOCKS4", "SOCKS5", "SOCKS5 password", "HTTP", "HTTP password"};