lucaspoffo / renet

Server/Client network library for multiplayer games with authentication and connection management made with Rust
Apache License 2.0
624 stars 67 forks source link

Add test for messages #17

Closed Shatur closed 2 years ago

Shatur commented 2 years ago

In this PR I added a test for messaging. But I noticed that it fails for some reason when sending a message from server more then once.

lucaspoffo commented 2 years ago

Well, what a journey it was to find the cause of this bug. Its fixed by 0ad3a20140381fefd50f80b326db301c61d75ad5. Renetcode was generating one packet with a wrong sequence, that wrong sequence was used in the replay protection causing one packet to be considered duplicated. So only one packet would ever be missed. In the test, it was not causing a panic because when the error occurred it was expected nothing to happen also, the same thing as a duplicated packet :0

The renetcode test was updated to catch this and your bevy test was added by a6401da1c81bcc6656759e545221224abb01a949

Shatur commented 2 years ago

Thank you a lot for digging into this!