Skip to content

Commit

Permalink
Merge pull request godotengine#95192 from Faless/mp/quite_relay_to_di…
Browse files Browse the repository at this point in the history
…sconnected

[MP] Avoid error spam in relay protocol when clients disconnect
  • Loading branch information
akien-mga committed Aug 6, 2024
2 parents 4577b37 + 531c72f commit 4359c28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/multiplayer/scene_multiplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,10 @@ void SceneMultiplayer::_process_sys(int p_from, const uint8_t *p_packet, int p_p
int len = p_packet_len - SYS_CMD_SIZE;
bool should_process = false;
if (get_unique_id() == 1) { // I am the server.
// Direct messages to server should not go through relay.
ERR_FAIL_COND(peer > 0 && !connected_peers.has(peer));
// The requested target might have disconnected while the packet was in transit.
if (unlikely(peer > 0 && !connected_peers.has(peer))) {
return;
}
// Send relay packet.
relay_buffer->seek(0);
relay_buffer->put_u8(NETWORK_COMMAND_SYS);
Expand Down

0 comments on commit 4359c28

Please sign in to comment.