aboutsummaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 5ec53a524..a777293a3 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -246,7 +246,7 @@ void Client::connect(Address address)
{
DSTACK(__FUNCTION_NAME);
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
- m_con.setTimeoutMs(0);
+ m_con.SetTimeoutMs(0);
m_con.Connect(address);
}
@@ -563,8 +563,8 @@ void Client::step(float dtime)
counter = 0.0;
//JMutexAutoLock lock(m_con_mutex); //bulk comment-out
// connectedAndInitialized() is true, peer exists.
- con::Peer *peer = m_con.GetPeer(PEER_ID_SERVER);
- infostream<<"Client: avg_rtt="<<peer->avg_rtt<<std::endl;
+ float avg_rtt = m_con.GetPeerAvgRTT(PEER_ID_SERVER);
+ infostream<<"Client: avg_rtt="<<avg_rtt<<std::endl;
}
}
@@ -709,14 +709,6 @@ void Client::ProcessData(u8 *data, u32 datasize, u16 sender_peer_id)
return;
}
- con::Peer *peer;
- {
- //JMutexAutoLock lock(m_con_mutex); //bulk comment-out
- // All data is coming from the server
- // PeerNotFoundException is handled by caller.
- peer = m_con.GetPeer(PEER_ID_SERVER);
- }
-
u8 ser_version = m_server_ser_ver;
//infostream<<"Client received command="<<(int)command<<std::endl;
@@ -2168,9 +2160,10 @@ ClientEvent Client::getClientEvent()
float Client::getRTT(void)
{
- con::Peer *peer = m_con.GetPeerNoEx(PEER_ID_SERVER);
- if(!peer)
- return 0.0;
- return peer->avg_rtt;
+ try{
+ return m_con.GetPeerAvgRTT(PEER_ID_SERVER);
+ } catch(con::PeerNotFoundException &e){
+ return 1337;
+ }
}