fix uninitialized variable in test_pe_crypto simulation

This commit is contained in:
arvidn 2015-08-12 20:18:47 -04:00
parent 243b31b56b
commit d2819cd1b9
4 changed files with 16 additions and 5 deletions

View File

@ -1562,7 +1562,7 @@ namespace libtorrent
};
// the encoding policy options for use with
// settings_pack::pe_out_enc_policy and settings_pack::pe_in_enc_policy.
// settings_pack::out_enc_policy and settings_pack::in_enc_policy.
enum enc_policy
{
// Only encrypted connections are allowed. Incoming connections that
@ -1581,7 +1581,7 @@ namespace libtorrent
};
// the encryption levels, to be used with
// settings_pack::pe_allowed_enc_level.
// settings_pack::allowed_enc_level.
enum enc_level
{
// use only plaintext encryption

View File

@ -74,10 +74,11 @@ void display_settings(libtorrent::settings_pack const& s)
struct test_swarm_config : swarm_config
{
test_swarm_config(libtorrent::settings_pack::enc_policy m_policy
test_swarm_config(libtorrent::settings_pack::enc_policy policy
, libtorrent::settings_pack::enc_level level
, bool prefer_rc4)
: swarm_config()
, m_policy(policy)
, m_level(level)
, m_prefer_rc4(prefer_rc4)
{}

View File

@ -304,7 +304,7 @@ namespace libtorrent
p.set_bool(settings_pack::enable_dht, false);
apply_settings(p);
}
#endif
#endif // TORRENT_NO_DEPRECATE
void session_handle::set_dht_settings(dht_settings const& settings)
{
@ -648,6 +648,16 @@ namespace libtorrent
void session_handle::apply_settings(settings_pack const& s)
{
TORRENT_ASSERT_PRECOND(!s.has_val(settings_pack::out_enc_policy)
|| s.get_int(settings_pack::out_enc_policy)
<= settings_pack::pe_disabled);
TORRENT_ASSERT_PRECOND(!s.has_val(settings_pack::in_enc_policy)
|| s.get_int(settings_pack::in_enc_policy)
<= settings_pack::pe_disabled);
TORRENT_ASSERT_PRECOND(!s.has_val(settings_pack::allowed_enc_level)
|| s.get_int(settings_pack::allowed_enc_level)
<= settings_pack::pe_both);
boost::shared_ptr<settings_pack> copy = boost::make_shared<settings_pack>(s);
TORRENT_ASYNC_CALL1(apply_settings_pack, copy);
}

View File

@ -591,7 +591,7 @@ namespace libtorrent
// disregard setting indices that are not string types
if ((i->first & settings_pack::type_mask) != settings_pack::string_type_base)
continue;
// ignore settings that are out of bounds
int index = i->first & settings_pack::index_mask;
if (index < 0 || index >= settings_pack::num_string_settings)