Open HashimTheArab opened 3 weeks ago
Im thinking we should only do this for conn.receive and not Decode so we dont end up with errors like this
DEBU[0009] dial attempt 1 failed: dial minecraft 192.168.140.68:64680->139.99.39.244:19132: read batch: read raknet 192.168.140.68:64680->139.99.39.244:19132: use of closed network connection
but thats not consistent so not sure what to do
nice!
This PR improves error messages when handling packets. These messages were written to the debugger before instead of being handled as an error
Before: DEBU[0005] dial attempt 1: dial minecraft 192.168.140.68:64906->162.248.102.67:19132: use of closed connection
After: DEBU[0005] dial attempt 1 failed: dial minecraft 12.168.140.68:64906->162.248.102.67:19132: handle *packet.PlayStatus: server outdated
The removed lines
_ = conn.Close()
should not make a difference they are already handled immediately in the following places: https://github.com/Sandertv/gophertunnel/blob/aed4aa48e09ecc81cf35f4e2625d41ff2efd1e52/minecraft/dial.go#L282 https://github.com/Sandertv/gophertunnel/blob/aed4aa48e09ecc81cf35f4e2625d41ff2efd1e52/minecraft/listener.go#L298 The reason for removal is so the select can catch the error before the closed conn