mas-bandwidth/yojimbo

Sending a message from server to disconnected client using unreliable channel.

awgil opened this issue · 2 comments

awgil commented

Currently if you try to send a message from server to disconnected client using unreliable channel, this message will be received by the next client that connects into same "slot".

The problem is that Server::SendMessage() simply calls UnreliableUnorderedChannel::SendMessage(), which adds message to the send queue, and this message stays there - Server::SendPackets() will skip disconnected clients. Next client that gets assigned to the same client index will then receive this message instead.

While it's easy to fix on the user side (skip code that sends messages to particular client if this client has disconnected), I think library should handle this better (either assert or ignore SendMessage, not sure which is better).

Seeing as it is an unreliable channel, the message should just be silently dropped. Can you make a PR that does this?

This should be fixed in head