Fix Travis/unittest broken since b662a45
authorSmallJoker <mk939@ymail.com>
Sat, 29 Apr 2017 12:36:55 +0000 (14:36 +0200)
committerSmallJoker <mk939@ymail.com>
Sat, 29 Apr 2017 14:40:56 +0000 (16:40 +0200)
src/client.cpp
src/network/connection.cpp
src/network/connection.h
src/unittest/test_connection.cpp

index 43b58d819ccaf8f54c0fc0ff72596ae0da5389b9..48ebd2f2c2a3a941bb60e7cee495082e11e03ba1 100644 (file)
@@ -769,7 +769,7 @@ void Client::initLocalMapSaving(const Address &address,
 void Client::ReceiveAll()
 {
        DSTACK(FUNCTION_NAME);
-       u32 start_ms = porting::getTimeMs();
+       u64 start_ms = porting::getTimeMs();
        for(;;)
        {
                // Limit time even if there would be huge amounts of data to
@@ -1631,7 +1631,7 @@ void texture_update_progress(void *args, u32 progress, u32 max_progress)
 
                // update the loading menu -- if neccessary
                bool do_draw = false;
-               u32 time_ms = targs->last_time_ms;
+               u64 time_ms = targs->last_time_ms;
                if (cur_percent != targs->last_percent) {
                        targs->last_percent = cur_percent;
                        time_ms = porting::getTimeMs();
index f9a4821a6af752ec18da825f121a836e41ed65f5..fb3ba92aefd16495fa9275c51ef0de0c701e783e 100644 (file)
@@ -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);
 }
@@ -981,7 +982,7 @@ void Peer::RTTStatistics(float rtt, const 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;
@@ -1276,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() << "]");
@@ -2046,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
 
@@ -2390,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
index dc86d22936acef4662c28f24179fad8a524f3a4a..3a8388522b83852c5a1e98ed13272a74de34fb64 100644 (file)
@@ -175,7 +175,7 @@ struct BufferedPacket
        Buffer<u8> data; // Data of the packet, including headers
        float time; // Seconds from buffering the packet or re-sending
        float totaltime; // Seconds from buffering the packet
-       unsigned int absolute_send_time;
+       u64 absolute_send_time;
        Address address; // Sender or destination
        unsigned int resend_count;
 };
index 49e412fc86b8b9997546bc3bd022424897c8816d..d63322d6902829e43fc7692ad68bd637505827fc 100644 (file)
@@ -305,7 +305,7 @@ void TestConnection::testConnectSendReceive()
                u16 peer_id = 132;
                u16 size = 0;
                bool received = false;
-               u32 timems0 = porting::getTimeMs();
+               u64 timems0 = porting::getTimeMs();
                for (;;) {
                        if (porting::getTimeMs() - timems0 > 5000 || received)
                                break;