Quantcast
Viewing all articles
Browse latest Browse all 1557

How to handle un-detectable disconnects by the master peer?

Hi all,

The networking solution that I am working on implements a similar concept to PUN, in that each room has a single peer which is considered the "master peer". This peer is responsible for sending updates about networked objects that are owned by the scene, and not by a specific peer.

The server handles the assigning of the master peer fine. Except when we get to a situation where the master peer loses internet connection or their local machine is forcefully shut down. In either situation, the master peer is unable to tell the server that it is disconnecting.

The server seems to eventually realize that the peer has disconnected. By the looks of things this is due to messages being sent to the (now disconnected) peer timing out after a few seconds and the server considering the peer to be disconnected.


So, the issue for me is that, if my master peer is sending updates to the server for "scene" owned objects (such as moving the objects around), between the time that the master peer disconnects in one of the ways mentioned above, and the time that the server realizes the peer is undetectable (which can sometimes be up to about 5 seconds), the "scene" owned objects suddenly stop moving, because the master peer is no longer sending updates and the server thinks the master peer is.


I have a few ideas on how to tackle this, such as sending a "ping" to the master peer on a high-frequency interval and re-assigning the master peer if we don't get a response within a certain time-frame, but I can see this causing problems... What would you guys suggest as the best way to handle this type of problem?

Any advice would be greatly appreciated.

Viewing all articles
Browse latest Browse all 1557

Trending Articles