diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index d4fcdc2d8..49ba8da67 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -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) diff --git a/src/pe_crypto.cpp b/src/pe_crypto.cpp index 30d550f6b..de558d195 100644 --- a/src/pe_crypto.cpp +++ b/src/pe_crypto.cpp @@ -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; diff --git a/src/timestamp_history.cpp b/src/timestamp_history.cpp index c679e918c..a0909dc3d 100644 --- a/src/timestamp_history.cpp +++ b/src/timestamp_history.cpp @@ -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) diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index a92c9d607..f3c8f161f 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -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