fixed build with no deprecated functions

This commit is contained in:
Arvid Norberg 2011-05-01 19:28:13 +00:00
parent 83ba5afaa5
commit 6f127dd07b
3 changed files with 11 additions and 7 deletions

View File

@ -3882,7 +3882,7 @@ namespace libtorrent
if (web->resolving) return; if (web->resolving) return;
if (int(m_connections.size()) >= m_max_connections 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; return;
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING #if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
@ -4028,7 +4028,7 @@ namespace libtorrent
if (m_ses.is_aborted()) return; if (m_ses.is_aborted()) return;
if (int(m_connections.size()) >= m_max_connections 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; return;
tcp::endpoint a(host->endpoint()); tcp::endpoint a(host->endpoint());
@ -4103,7 +4103,7 @@ namespace libtorrent
} }
if (int(m_connections.size()) >= m_max_connections 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; return;
tcp::endpoint a(host->endpoint()); 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 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 if (!is_finished() && !m_web_seeds.empty() && m_files_checked
&& int(m_connections.size()) < m_max_connections && 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; return;
{ {

View File

@ -101,7 +101,10 @@ void send_dht_msg(node_impl& node, char const* msg, udp::endpoint const& ep
// std::cerr << "sending: " << e << "\n"; // std::cerr << "sending: " << e << "\n";
lazy_entry decoded; 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); dht::msg m(decoded, ep);
node.incoming(m); 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]; static char inbuf[1500];
int len = bencode(inbuf, i->second); int len = bencode(inbuf, i->second);
g_responses.erase(i); g_responses.erase(i);
error_code ec;
int ret = lazy_bdecode(inbuf, inbuf + len, *reply, ec); int ret = lazy_bdecode(inbuf, inbuf + len, *reply, ec);
TEST_CHECK(ret == 0); TEST_CHECK(ret == 0);
} }

View File

@ -57,8 +57,10 @@ void test_transfer(boost::intrusive_ptr<torrent_info> torrent_file
settings.max_queued_disk_bytes = 256 * 1024; settings.max_queued_disk_bytes = 256 * 1024;
ses.set_settings(settings); ses.set_settings(settings);
ses.set_alert_mask(~(alert::progress_notification | alert::stats_notification)); ses.set_alert_mask(~(alert::progress_notification | alert::stats_notification));
ses.listen_on(std::make_pair(51000, 52000));
error_code ec; 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); remove_all("./tmp2_web_seed", ec);
char const* test_name[] = {"no", "SOCKS4", "SOCKS5", "SOCKS5 password", "HTTP", "HTTP password"}; char const* test_name[] = {"no", "SOCKS4", "SOCKS5", "SOCKS5 password", "HTTP", "HTTP password"};