diff options
Diffstat (limited to 'src/network/connection.h')
-rw-r--r-- | src/network/connection.h | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/network/connection.h b/src/network/connection.h index 49bb65c3e..ea74ffb1c 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -420,34 +420,38 @@ public: void UpdateTimers(float dtime); - const float getCurrentDownloadRateKB() + float getCurrentDownloadRateKB() { MutexAutoLock lock(m_internal_mutex); return cur_kbps; }; - const float getMaxDownloadRateKB() + float getMaxDownloadRateKB() { MutexAutoLock lock(m_internal_mutex); return max_kbps; }; - const float getCurrentLossRateKB() + float getCurrentLossRateKB() { MutexAutoLock lock(m_internal_mutex); return cur_kbps_lost; }; - const float getMaxLossRateKB() + float getMaxLossRateKB() { MutexAutoLock lock(m_internal_mutex); return max_kbps_lost; }; - const float getCurrentIncomingRateKB() + float getCurrentIncomingRateKB() { MutexAutoLock lock(m_internal_mutex); return cur_incoming_kbps; }; - const float getMaxIncomingRateKB() + float getMaxIncomingRateKB() { MutexAutoLock lock(m_internal_mutex); return max_incoming_kbps; }; - const float getAvgDownloadRateKB() + float getAvgDownloadRateKB() { MutexAutoLock lock(m_internal_mutex); return avg_kbps; }; - const float getAvgLossRateKB() + float getAvgLossRateKB() { MutexAutoLock lock(m_internal_mutex); return avg_kbps_lost; }; - const float getAvgIncomingRateKB() + float getAvgIncomingRateKB() { MutexAutoLock lock(m_internal_mutex); return avg_incoming_kbps; }; - const unsigned int getWindowSize() const { return window_size; }; + u16 getWindowSize() const { return m_window_size; }; + + void setWindowSize(long size) + { + m_window_size = (u16)rangelim(size, MIN_RELIABLE_WINDOW_SIZE, MAX_RELIABLE_WINDOW_SIZE); + } - void setWindowSize(unsigned int size) { window_size = size; }; private: std::mutex m_internal_mutex; - int window_size = MIN_RELIABLE_WINDOW_SIZE; + u16 m_window_size = MIN_RELIABLE_WINDOW_SIZE; u16 next_incoming_seqnum = SEQNUM_INITIAL; @@ -765,7 +769,7 @@ public: Address GetPeerAddress(session_t peer_id); float getPeerStat(session_t peer_id, rtt_stat_type type); float getLocalStat(rate_stat_type type); - const u32 GetProtocolID() const { return m_protocol_id; }; + u32 GetProtocolID() const { return m_protocol_id; }; const std::string getDesc(); void DisconnectPeer(session_t peer_id); |