mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Flush NETMSG_PING
and NETMSG_PING_REPLY
The client measures the time difference between ping send and ping reply receive. Without MSGFLAG_FLUSH the server keeps the chunk until the next flush which makes the ping dependend on when the next flush happens.
This commit is contained in:
parent
fdc425b5f5
commit
97ac4e791e
|
@ -1808,7 +1808,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
else if(Msg == NETMSG_PING)
|
||||
{
|
||||
CMsgPacker MsgP(NETMSG_PING_REPLY, true);
|
||||
SendMsg(Conn, &MsgP, 0);
|
||||
SendMsg(Conn, &MsgP, MSGFLAG_FLUSH);
|
||||
}
|
||||
else if(Msg == NETMSG_PINGEX)
|
||||
{
|
||||
|
@ -3463,7 +3463,7 @@ void CClient::Con_Ping(IConsole::IResult *pResult, void *pUserData)
|
|||
CClient *pSelf = (CClient *)pUserData;
|
||||
|
||||
CMsgPacker Msg(NETMSG_PING, true);
|
||||
pSelf->SendMsg(CONN_MAIN, &Msg, 0);
|
||||
pSelf->SendMsg(CONN_MAIN, &Msg, MSGFLAG_FLUSH);
|
||||
pSelf->m_PingStartTime = time_get();
|
||||
}
|
||||
|
||||
|
|
|
@ -1751,7 +1751,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
|
|||
else if(Msg == NETMSG_PING)
|
||||
{
|
||||
CMsgPacker Msgp(NETMSG_PING_REPLY, true);
|
||||
SendMsg(&Msgp, 0, ClientID);
|
||||
SendMsg(&Msgp, MSGFLAG_FLUSH, ClientID);
|
||||
}
|
||||
else if(Msg == NETMSG_PINGEX)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue