minor debug logging issue in test facility wait-for-alert and fix minor shutdown issue with udp_socket packet subscription

This commit is contained in:
arvidn 2016-02-08 02:05:00 -05:00
parent 7b1a8ff6f1
commit dd48faa8d4
3 changed files with 17 additions and 3 deletions

View File

@ -5924,7 +5924,7 @@ retry:
#ifdef TORRENT_USE_OPENSSL
m_ssl_udp_socket.unsubscribe(this);
m_ssl_udp_socket.unsubscribe(&m_utp_socket_manager);
m_ssl_udp_socket.unsubscribe(&m_ssl_utp_socket_manager);
#endif
TORRENT_ASSERT(m_torrents.empty());
@ -6048,6 +6048,8 @@ retry:
}
#endif
// TODO: 2 this should be factored into the udp socket, so we only have the
// code once
void session_impl::update_peer_tos()
{
error_code ec;

View File

@ -6009,18 +6009,27 @@ namespace libtorrent
if (alerts().should_post<torrent_error_alert>())
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec, certificate);
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** use certificate file: %s", ec.message().c_str());
#endif
m_ssl_ctx->use_private_key_file(private_key, context::pem, ec);
if (ec)
{
if (alerts().should_post<torrent_error_alert>())
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec, private_key);
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** use private key file: %s", ec.message().c_str());
#endif
m_ssl_ctx->use_tmp_dh_file(dh_params, ec);
if (ec)
{
if (alerts().should_post<torrent_error_alert>())
alerts().emplace_alert<torrent_error_alert>(get_handle(), ec, dh_params);
}
#ifndef TORRENT_DISABLE_LOGGING
debug_log("*** use DH file: %s", ec.message().c_str());
#endif
}
void torrent::set_ssl_cert_buffer(std::string const& certificate

View File

@ -155,6 +155,8 @@ alert const* wait_for_alert(lt::session& ses, int type, char const* name)
time_point now = clock_type::now();
if (now > end) return NULL;
alert const* ret = NULL;
ses.wait_for_alert(end - now);
std::vector<alert*> alerts;
ses.pop_alerts(&alerts);
@ -163,11 +165,12 @@ alert const* wait_for_alert(lt::session& ses, int type, char const* name)
{
fprintf(stderr, "%s: %s: [%s] %s\n", time_now_string(), name
, (*i)->what(), (*i)->message().c_str());
if ((*i)->type() == type)
if ((*i)->type() == type && !ret)
{
return *i;
ret = *i;
}
}
if (ret) return ret;
}
return NULL;
}