trouble shoot segfault on travis

This commit is contained in:
arvidn 2015-08-12 18:54:57 -04:00
parent b703a8fb89
commit 243b31b56b
1 changed files with 11 additions and 9 deletions

View File

@ -186,20 +186,22 @@ namespace libtorrent
#if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS)
boost::uint8_t out_enc_policy = m_settings.get_int(settings_pack::out_enc_policy); boost::uint8_t out_policy = m_settings.get_int(settings_pack::out_enc_policy);
#ifdef TORRENT_USE_OPENSSL #ifdef TORRENT_USE_OPENSSL
// never try an encrypted connection when already using SSL // never try an encrypted connection when already using SSL
if (is_ssl(*get_socket())) if (is_ssl(*get_socket()))
out_enc_policy = settings_pack::pe_disabled; out_policy = settings_pack::pe_disabled;
#endif #endif
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
char const* policy_name[] = {"forced", "enabled", "disabled"}; char const* policy_name[] = {"forced", "enabled", "disabled"};
TORRENT_ASSERT(out_policy < sizeof(policy_name)/sizeof(policy_name[0]));
TORRENT_ASSERT(out_policy >= 0);
peer_log(peer_log_alert::info, "ENCRYPTION" peer_log(peer_log_alert::info, "ENCRYPTION"
, "outgoing encryption policy: %s", policy_name[out_enc_policy]); , "outgoing encryption policy: %s", policy_name[out_policy]);
#endif #endif
if (out_enc_policy == settings_pack::pe_forced) if (out_policy == settings_pack::pe_forced)
{ {
write_pe1_2_dhkey(); write_pe1_2_dhkey();
if (is_disconnecting()) return; if (is_disconnecting()) return;
@ -208,7 +210,7 @@ namespace libtorrent
m_recv_buffer.reset(dh_key_len); m_recv_buffer.reset(dh_key_len);
setup_receive(); setup_receive();
} }
else if (out_enc_policy == settings_pack::pe_enabled) else if (out_policy == settings_pack::pe_enabled)
{ {
TORRENT_ASSERT(peer_info_struct()); TORRENT_ASSERT(peer_info_struct());
@ -241,7 +243,7 @@ namespace libtorrent
setup_receive(); setup_receive();
} }
} }
else if (out_enc_policy == settings_pack::pe_disabled) else if (out_policy == settings_pack::pe_disabled)
#endif #endif
{ {
write_handshake(); write_handshake();