fix merge issue

This commit is contained in:
arvidn 2016-12-21 01:00:49 -05:00 committed by Arvid Norberg
parent a2c4e7490e
commit cde9457fdb
6 changed files with 22 additions and 9 deletions

View File

@ -88,7 +88,7 @@ struct fake_peer
m_info_hash = ih;
boost::system::error_code ec;
std::printf("fake_peer::connect_to(%s)\n", lt::print_endpoint(ep).c_str());
m_socket.async_connect(ep, std::bind(&fake_peer::write_handshake
, this, _1, ih));
}
@ -139,10 +139,10 @@ private:
{
using namespace std::placeholders;
asio::ip::tcp::endpoint const ep = m_socket.remote_endpoint();
std::printf("fake_peer::connect (%s) -> (%d) %s\n"
, lt::print_endpoint(ep).c_str(), ec.value()
, ec.message().c_str());
std::printf("fake_peer::connect() -> (%d) %s\n"
, ec.value(), ec.message().c_str());
if (ec) return;
static char const handshake[]
= "\x13" "BitTorrent protocol\0\0\0\0\0\0\0\x04"
" " // space for info-hash
@ -151,6 +151,7 @@ private:
memcpy(m_out_buffer, handshake, len);
memcpy(&m_out_buffer[28], ih.data(), 20);
asio::ip::tcp::endpoint const ep = m_socket.remote_endpoint();
asio::async_write(m_socket, asio::const_buffers_1(&m_out_buffer[0]
, len), [this, ep](boost::system::error_code const& ec
, size_t /* bytes_transferred */)

View File

@ -100,7 +100,7 @@ TORRENT_TEST(dht_bootstrap)
sim::default_config cfg;
sim::simulation sim{cfg};
dht_network dht(sim, 1000);
dht_network dht(sim, 1200);
int routing_table_depth = 0;
int num_nodes = 0;

View File

@ -324,7 +324,7 @@ TORRENT_TEST(udp_tracker)
tracker_alert = true;
},
[&](sim::simulation& sim, lt::session& ses
, boost::shared_ptr<lt::torrent_info> ti)
, std::shared_ptr<lt::torrent_info> ti)
{
// listen on port 8080
udp_server tracker(sim, "2.2.2.2", 8080,

View File

@ -2002,8 +2002,12 @@ namespace aux {
ADD_OUTSTANDING_ASYNC("session_impl::on_socks_listen");
socks5_stream& s = *m_socks_listen_socket->get<socks5_stream>();
m_socks_listen_port = listen_port();
if (m_socks_listen_port == 0) m_socks_listen_port = std::uint16_t(2000 + random(60000));
// figure out which port to ask the socks5 proxy to open or us.
m_socks_listen_port = (m_listen_sockets.empty()
|| m_settings.get_bool(settings_pack::anonymous_mode))
? std::uint16_t(2000 + random(60000))
: std::uint16_t(m_listen_sockets.front().tcp_external_port);
s.async_listen(tcp::endpoint(address_v4::any(), m_socks_listen_port)
, std::bind(&session_impl::on_socks_listen, this
, m_socks_listen_socket, _1));

View File

@ -65,15 +65,21 @@ TORRENT_TEST(create_directory)
{
error_code ec;
create_directory("__foobar__", ec);
if (ec) std::printf("ERROR: create_directory: (%d) %s\n"
, ec.value(), ec.message().c_str());
TEST_CHECK(!ec);
file_status st;
stat_file("__foobar__", &st, ec);
if (ec) std::printf("ERROR: stat_file: (%d) %s\n"
, ec.value(), ec.message().c_str());
TEST_CHECK(!ec);
TEST_CHECK(st.mode & file_status::directory);
remove("__foobar__", ec);
if (ec) std::printf("ERROR: remove: (%d) %s\n"
, ec.value(), ec.message().c_str());
TEST_CHECK(!ec);
}

View File

@ -112,6 +112,8 @@ void test_read_piece(int flags)
if (flags & seed_mode)
p.flags |= add_torrent_params::flag_seed_mode;
torrent_handle tor1 = ses.add_torrent(p, ec);
if (ec) std::printf("ERROR: add_torrent: (%d) %s\n"
, ec.value(), ec.message().c_str());
TEST_CHECK(!ec);
TEST_CHECK(tor1.is_valid());