diff options
author | ShadowNinja <shadowninja@minetest.net> | 2017-06-03 14:55:10 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2017-06-03 14:55:10 -0400 |
commit | caecdb681c428c1aab9c0f7eec2570c0460f995c (patch) | |
tree | e5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/network/connection.cpp | |
parent | 81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff) | |
parent | 80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff) | |
download | minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2 minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip |
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/network/connection.cpp')
-rw-r--r-- | src/network/connection.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/network/connection.cpp b/src/network/connection.cpp index b711cae11..fb3ba92ae 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -54,7 +54,8 @@ Mutex log_message_mutex; #endif -static inline float CALC_DTIME(unsigned int lasttime, unsigned int curtime) { +static inline float CALC_DTIME(u64 lasttime, u64 curtime) +{ float value = ( curtime - lasttime) / 1000.0; return MYMAX(MYMIN(value,0.1),0.0); } @@ -930,7 +931,7 @@ void Peer::DecUseCount() delete this; } -void Peer::RTTStatistics(float rtt, std::string profiler_id, +void Peer::RTTStatistics(float rtt, const std::string &profiler_id, unsigned int num_samples) { if (m_last_rtt > 0) { @@ -969,8 +970,7 @@ void Peer::RTTStatistics(float rtt, std::string profiler_id, m_rtt.jitter_avg = m_rtt.jitter_avg * (num_samples/(num_samples-1)) + jitter * (1/num_samples); - if (profiler_id != "") - { + if (profiler_id != "") { g_profiler->graphAdd(profiler_id + "_rtt", rtt); g_profiler->graphAdd(profiler_id + "_jitter", jitter); } @@ -982,7 +982,7 @@ void Peer::RTTStatistics(float rtt, std::string profiler_id, bool Peer::isTimedOut(float timeout) { MutexAutoLock lock(m_exclusive_access_mutex); - u32 current_time = porting::getTimeMs(); + u64 current_time = porting::getTimeMs(); float dtime = CALC_DTIME(m_last_timeout_check,current_time); m_last_timeout_check = current_time; @@ -1237,7 +1237,7 @@ void UDPPeer::RunCommandQueues( u16 UDPPeer::getNextSplitSequenceNumber(u8 channel) { assert(channel < CHANNEL_COUNT); // Pre-condition - return channels[channel].readNextIncomingSeqNum(); + return channels[channel].readNextSplitSeqNum(); } void UDPPeer::setNextSplitSequenceNumber(u8 channel, u16 seqnum) @@ -1277,8 +1277,8 @@ void * ConnectionSendThread::run() LOG(dout_con<<m_connection->getDesc() <<"ConnectionSend thread started"<<std::endl); - u32 curtime = porting::getTimeMs(); - u32 lasttime = curtime; + u64 curtime = porting::getTimeMs(); + u64 lasttime = curtime; PROFILE(std::stringstream ThreadIdentifier); PROFILE(ThreadIdentifier << "ConnectionSend: [" << m_connection->getDesc() << "]"); @@ -2047,8 +2047,8 @@ void * ConnectionReceiveThread::run() PROFILE(ThreadIdentifier << "ConnectionReceive: [" << m_connection->getDesc() << "]"); #ifdef DEBUG_CONNECTION_KBPS - u32 curtime = porting::getTimeMs(); - u32 lasttime = curtime; + u64 curtime = porting::getTimeMs(); + u64 lasttime = curtime; float debug_print_timer = 0.0; #endif @@ -2391,7 +2391,7 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel, // only calculate rtt from straight sent packets if (p.resend_count == 0) { // Get round trip time - unsigned int current_time = porting::getTimeMs(); + u64 current_time = porting::getTimeMs(); // a overflow is quite unlikely but as it'd result in major // rtt miscalculation we handle it here |