Fix numeric underflow on calculating window size adjustment
authorsapier <Sapier at GMX dot net>
Sun, 4 May 2014 00:43:01 +0000 (02:43 +0200)
committersapier <Sapier at GMX dot net>
Sun, 4 May 2014 00:43:01 +0000 (02:43 +0200)
src/connection.cpp
src/connection.h

index e6b763206a3a7ee19b58c0495219d728dfd7c807..341333db9c1ac5a74ca7c2de9de6617f249c7134 100644 (file)
@@ -716,7 +716,7 @@ void Channel::UpdateTimers(float dtime,bool legacy_peer)
                        packet_too_late = current_packet_too_late;
                        packets_successfull = current_packet_successfull;
 
-                       if (current_bytes_transfered > (window_size*512/2))
+                       if (current_bytes_transfered > (unsigned int) (window_size*512/2))
                        {
                                reasonable_amount_of_data_transmitted = true;
                        }
index 90344da3efd428bc6fc8eca94c1062c69d2f79a7..338ee964ce36378ff4aff16579ef4255aa6befe2 100644 (file)
@@ -546,7 +546,7 @@ public:
        void setWindowSize(unsigned int size) { window_size = size; };
 private:
        JMutex m_internal_mutex;
-       unsigned int window_size;
+       int window_size;
 
        u16 next_incoming_seqnum;