]> git.lizzy.rs Git - minetest.git/blobdiff - src/connection.cpp
jthread remove locks that aren't absolutely required
[minetest.git] / src / connection.cpp
index 8a23f67c3e48b8845267056b83fc420f8ac38754..32634ac8948f3979846ca78120f48f9c65f19c33 100644 (file)
@@ -212,7 +212,7 @@ SharedBuffer<u8> makeReliablePacket(
        ReliablePacketBuffer
 */
 
-ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0),writeptr(0) {}
+ReliablePacketBuffer::ReliablePacketBuffer(): m_list_size(0) {}
 
 void ReliablePacketBuffer::print()
 {
@@ -1227,6 +1227,8 @@ void * ConnectionSendThread::Thread()
        PROFILE(std::stringstream ThreadIdentifier);
        PROFILE(ThreadIdentifier << "ConnectionSend: [" << m_connection->getDesc() << "]");
 
+       porting::setThreadName("ConnectionSend");
+
        /* if stop is requested don't stop immediately but try to send all        */
        /* packets first */
        while(!StopRequested() || packetsQueued()) {
@@ -1939,8 +1941,7 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
 
 ConnectionReceiveThread::ConnectionReceiveThread(Connection* parent,
                                                                                                unsigned int max_packet_size) :
-       m_connection(parent),
-       m_max_packet_size(max_packet_size)
+       m_connection(parent)
 {
 }
 
@@ -1955,6 +1956,8 @@ void * ConnectionReceiveThread::Thread()
        PROFILE(std::stringstream ThreadIdentifier);
        PROFILE(ThreadIdentifier << "ConnectionReceive: [" << m_connection->getDesc() << "]");
 
+       porting::setThreadName("ConnectionReceive");
+
 #ifdef DEBUG_CONNECTION_KBPS
        u32 curtime = porting::getTimeMs();
        u32 lasttime = curtime;
@@ -2875,11 +2878,11 @@ Address Connection::GetPeerAddress(u16 peer_id)
        return peer_address;
 }
 
-float Connection::GetPeerAvgRTT(u16 peer_id)
+float Connection::getPeerStat(u16 peer_id, rtt_stat_type type)
 {
        PeerHelper peer = getPeerNoEx(peer_id);
        if (!peer) return -1;
-       return peer->getStat(AVG_RTT);
+       return peer->getStat(type);
 }
 
 u16 Connection::createPeer(Address& sender, MTProtocols protocol, int fd)