TestSubject06 / GodotSceneSafeMultiplayer

A collection of high level multiplayer nodes that handshake between the authority and remote peers to prevent sending data to peers that are not yet ready to receive data.
MIT License
21 stars 0 forks source link

"unregister_synchronizer" method often breaks when client disconnects #2

Open Gavitro opened 2 months ago

Gavitro commented 2 months ago

When a peer disconnects, it attempts to RPC to other peers to unregister its own synchronizers, but often fails. As a result, the synchronizer maps of the remaining peers don't erase the disconnected peer's synchronizers, leading to memory leaks if left unchecked.

Steps to replicate

TestSubject06 commented 2 months ago

I'll need a little time to think this over. It was something I had observed once or twice, but felt it was benign enough to neglect. My rationale was that a handful of potential extra entries in a hashmap wasn't going to be enough of a problem in normal running cases to warrant a rework.

I think it could be relatively quick to fix it by listening for a peer disconnected signal and cleaning up the maps on that. The RPC signals are more intended for in-game comms rather than the entire client exiting.