1
0

Call ProcessProtocolOut at opportune times

This commit is contained in:
Tiger Wang 2021-03-28 21:20:13 +01:00
parent c24e968f2c
commit abcc14076c
2 changed files with 11 additions and 6 deletions

View File

@ -130,8 +130,9 @@ void cClientHandle::Destroy(void)
{
cCSLock Lock(m_CSOutgoingData);
m_Link->Shutdown(); // Cleanly close the connection
m_Link.reset(); // Release the strong reference cTCPLink holds to ourself
m_Link->Send(m_OutgoingData.data(), m_OutgoingData.size()); // Flush remaining data.
m_Link->Shutdown(); // Cleanly close the connection.
m_Link.reset(); // Release the strong reference cTCPLink holds to ourself.
}
}
@ -1933,9 +1934,12 @@ void cClientHandle::RemoveFromWorld(void)
m_SentChunks.clear();
}
// Flush outgoing data:
ProcessProtocolOut();
// No need to send Unload Chunk packets, the client unloads automatically.
// Here, we set last streamed values to bogus ones so everything is resent
// Here, we set last streamed values to bogus ones so everything is resent:
m_LastStreamedChunkX = 0x7fffffff;
m_LastStreamedChunkZ = 0x7fffffff;
}
@ -2105,6 +2109,7 @@ void cClientHandle::Tick(float a_Dt)
void cClientHandle::ServerTick(float a_Dt)
{
ProcessProtocolIn();
ProcessProtocolOut();
m_TicksSinceLastPacket += 1;
if (m_TicksSinceLastPacket > 600) // 30 seconds

View File

@ -3075,14 +3075,14 @@ void cPlayer::OnRemoveFromWorld(cWorld & a_World)
AwardAchievement(Statistic::AchPortal);
}
// Clientside warp start:
m_ClientHandle->SendRespawn(DestinationDimension, false);
// Clear sent chunk lists from the clienthandle:
m_ClientHandle->RemoveFromWorld();
// The clienthandle caches the coords of the chunk we're standing at. Invalidate this.
m_ClientHandle->InvalidateCachedSentChunk();
// Clientside warp start:
m_ClientHandle->SendRespawn(DestinationDimension, false);
}