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:
ChillerDragon 2023-01-25 20:55:07 +01:00 committed by Robert Müller
parent fdc425b5f5
commit 97ac4e791e
2 changed files with 3 additions and 3 deletions

View file

@ -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();
}

View file

@ -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)
{