RiptideNetworking / Riptide

Lightweight C# networking solution for multiplayer games.
https://riptide.tomweiland.net
MIT License
1.06k stars 141 forks source link

NullReferenceException at Riptide.Connection.ResetTimeout() #108

Closed megalithos closed 11 months ago

megalithos commented 11 months ago

Stacktrace: NullReferenceException: Object reference not set to an instance of an object Riptide.Connection.ResetTimeout () (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Connection.set_CanTimeout (System.Boolean value) (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Connection..ctor () (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Transports.Udp.UdpConnection..ctor (System.Net.IPEndPoint remoteEndPoint, Riptide.Transports.Udp.UdpPeer peer) (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Transports.Udp.UdpServer.HandleConnectionAttempt (System.Net.IPEndPoint fromEndPoint) (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Transports.Udp.UdpServer.OnDataReceived (System.Byte[] dataBuffer, System.Int32 amount, System.Net.IPEndPoint fromEndPoint) (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Transports.Udp.UdpPeer.Receive () (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Transports.Udp.UdpPeer.Poll () (at <85fe13f5f6584fb693617e32fdb2c96b>:0) Riptide.Server.Update () (at <85fe13f5f6584fb693617e32fdb2c96b>:0)

megalithos commented 11 months ago

I fixed this on my fork branch just by null checking Peer in ResetTimeout() before accessing it.

Also tested with custom TimeoutTime and it is working.

tom-weiland commented 11 months ago

Ah I only now saw this, and I already fixed it in 46315170191965e002e5059963c9656c28f31517.