fixed some uninitalized variables

This commit is contained in:
Arvid Norberg 2010-12-24 23:54:03 +00:00
parent daea6d507e
commit 1074fc1f31
4 changed files with 8 additions and 2 deletions

View File

@ -99,6 +99,7 @@ namespace libtorrent
, m_state(read_protocol_identifier)
#ifndef TORRENT_DISABLE_EXTENSIONS
, m_upload_only_id(0)
, m_holepunch_id(0)
, m_share_mode_id(0)
, m_supports_extensions(false)
#endif
@ -134,6 +135,9 @@ namespace libtorrent
: peer_connection(ses, s, remote, peerinfo)
, m_state(read_protocol_identifier)
#ifndef TORRENT_DISABLE_EXTENSIONS
, m_upload_only_id(0)
, m_holepunch_id(0)
, m_share_mode_id(0)
, m_supports_extensions(false)
#endif
, m_supports_dht_port(false)

View File

@ -109,7 +109,8 @@ get_out:
#elif defined TORRENT_USE_OPENSSL
// create local key
RAND_bytes((unsigned char*)m_dh_local_secret, sizeof(m_dh_local_secret));
for (int i = 0; i < sizeof(m_dh_local_secret); ++i)
m_dh_local_secret[i] = rand();
BIGNUM* prime = 0;
BIGNUM* secret = 0;

View File

@ -93,6 +93,7 @@ boost::uint32_t timestamp_history::add_sample(boost::uint32_t sample, bool step)
void timestamp_history::adjust_base(int change)
{
TORRENT_ASSERT(m_initialized);
m_base += change;
// make sure this adjustment sticks by updating all history slots
for (int i = 0; i < history_size; ++i)

View File

@ -2129,7 +2129,7 @@ bool utp_socket_impl::incoming_packet(char const* buf, int size
UTP_LOGV("%8p: their_delay::add_sample:%u prev_base:%u new_base:%u\n"
, this, m_reply_micro, prev_base, m_their_delay_hist.base());
if (prev_base && base_change < 0 && base_change > -10000)
if (prev_base && base_change < 0 && base_change > -10000 && m_delay_hist.initialized())
{
// their base delay went down. This is caused by clock drift. To compensate,
// adjust our base delay upwards