From ceb0ac614876556f341c581bac072e27aac45a02 Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 10 Feb 2016 02:09:12 -0500 Subject: [PATCH] fix issue in socket binding and back-port ssl test reliability fix --- src/session_impl.cpp | 5 +++++ test/test_ssl.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 1e6cbd4ab..214ecd054 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1982,6 +1982,11 @@ retry: if (!ec && s.sock) { + // update the listen_interface member with the + // actual port we ended up listening on, so that the other + // sockets can be bound to the same one + m_listen_interface.port(s.external_port); + TORRENT_ASSERT(!m_abort); m_listen_sockets.push_back(s); diff --git a/test/test_ssl.cpp b/test/test_ssl.cpp index 7dd7d7261..83073433d 100644 --- a/test/test_ssl.cpp +++ b/test/test_ssl.cpp @@ -209,6 +209,9 @@ void test_ssl(int test_idx, bool use_utp) ses2.status(); } + wait_for_alert(ses1, torrent_finished_alert::alert_type, "ses1"); + wait_for_downloading(ses2, "ses2"); + // connect the peers after setting the certificates int port = 0; if (test.use_ssl_ports) @@ -219,7 +222,7 @@ void test_ssl(int test_idx, bool use_utp) else port = ses2.listen_port(); - fprintf(stderr, "%s: ses1: connecting peer port: %d\n" + fprintf(stderr, "\n\n%s: ses1: connecting peer port: %d\n\n\n" , time_now_string(), port); tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec) , port)); @@ -263,7 +266,7 @@ void test_ssl(int test_idx, bool use_utp) if (st2.state != torrent_status::downloading) { - static char const* state_str[] = + static char const* state_str[] = {"checking (q)", "checking", "dl metadata" , "downloading", "finished", "seeding", "allocating", "checking (r)"}; std::cerr << "st2 state: " << state_str[st2.state] << std::endl;