MidLevel / Ruffles

Lightweight and fully managed reliable UDP library.
MIT License
212 stars 28 forks source link

Issue with iOS sockets resuming after screen is locked #32

Open figs999 opened 3 years ago

figs999 commented 3 years ago

When using Ruffles as transport for MLAPI v11, when iOS client device has screen locked for over ~5 seconds, after the device is unlocked Ruffles library begins spamming error messages and the transport stops working entirely.

Error includes this exception in printout: System.Net.Sockets.SocketException (0x80004005): The socket is not connected

Error message is being printed in the Socket's StartSocketLogic loop. https://github.com/MidLevel/Ruffles/blob/6d940c6eff3cdc98264324820bfb23639255cce1/Ruffles/Core/RuffleSocket.cs#L947

This issue appears to be identical to issue that is reported to LiteNetLib repo here: https://github.com/RevenantX/LiteNetLib/issues/312

For reference on solution, LiteNetLib fixed this issue in the following commits: https://github.com/RevenantX/LiteNetLib/commit/61427680a4519c6f60c6d0ec058542b51f1789c7 https://github.com/RevenantX/LiteNetLib/commit/dac4fea7f3d1d375faa8c4c1afaf8b8f9f32f28e

image