Merge pull request #473 from arvidn/bind-ssl-fix-1.1

fix issue in socket binding and back-port ssl test reliability fix
This commit is contained in:
Arvid Norberg 2016-02-10 19:47:34 -05:00
commit 7d8566f694
2 changed files with 10 additions and 2 deletions

View File

@ -1982,6 +1982,11 @@ retry:
if (!ec && s.sock) 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); TORRENT_ASSERT(!m_abort);
m_listen_sockets.push_back(s); m_listen_sockets.push_back(s);

View File

@ -209,6 +209,9 @@ void test_ssl(int test_idx, bool use_utp)
ses2.status(); ses2.status();
} }
wait_for_alert(ses1, torrent_finished_alert::alert_type, "ses1");
wait_for_downloading(ses2, "ses2");
// connect the peers after setting the certificates // connect the peers after setting the certificates
int port = 0; int port = 0;
if (test.use_ssl_ports) if (test.use_ssl_ports)
@ -219,7 +222,7 @@ void test_ssl(int test_idx, bool use_utp)
else else
port = ses2.listen_port(); 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); , time_now_string(), port);
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec) tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
, port)); , port));
@ -263,7 +266,7 @@ void test_ssl(int test_idx, bool use_utp)
if (st2.state != torrent_status::downloading) if (st2.state != torrent_status::downloading)
{ {
static char const* state_str[] = static char const* state_str[] =
{"checking (q)", "checking", "dl metadata" {"checking (q)", "checking", "dl metadata"
, "downloading", "finished", "seeding", "allocating", "checking (r)"}; , "downloading", "finished", "seeding", "allocating", "checking (r)"};
std::cerr << "st2 state: " << state_str[st2.state] << std::endl; std::cerr << "st2 state: " << state_str[st2.state] << std::endl;