File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,6 +155,10 @@ tl::expected<void, PacketError> base::HandleDisconnect(packet &pkt)
155155
156156tl::expected<void , PacketError> base::HandleEchoRequest (packet &pkt)
157157{
158+ // If we have already left the game,
159+ // there is no need to respond to echoes
160+ if (plr_self == PLR_BROADCAST) return {};
161+
158162 return pkt.Time ()
159163 .and_then ([&](cookie_t &&pktTime) {
160164 return pktfty->make_packet <PT_ECHO_REPLY>(plr_self, pkt.Source (), pktTime);
@@ -168,6 +172,7 @@ tl::expected<void, PacketError> base::HandleEchoReply(packet &pkt)
168172{
169173 const uint32_t now = SDL_GetTicks ();
170174 plr_t src = pkt.Source ();
175+ if (src >= MAX_PLRS) return {};
171176 return pkt.Time ().transform ([&](cookie_t &&pktTime) {
172177 PlayerState &playerState = playerStateTable_[src];
173178 playerState.roundTripLatency = now - pktTime;
You can’t perform that action at this time.
0 commit comments