Closed Partmedia closed 2 years ago
After a discussion in Discord we weren't sure what the deal with this ENOBUFS
is. After pouring over man pages and POSIX specs we basically came to the conclusion it's just a random code the OS can throw in some undefined circumstances, so I don't know we can really do anything about it.
The actual connection problem mentioned was finally diagnosed to be an MTU issue, fixed in 39f967e1cd4115b316fa2cc4d0668e60b231dba9.
Several SS14 players have reported on Discord and elsewhere that they sometimes get stuck when connecting to the official servers at the "Connection Established" window, where the client seems to hang. Because this Heisenbug is difficult to reproduce, it seems to have evaded detection and squashing. I believe I have finally chased down this bug.
Steps to Reproduce
What's happening here is that
SendTo()
is returning less bytes than the caller wanted it to send, which, for very good reasons, can happen on Windows and Unix.Specifically, the OS guesstimates a good size for the transmit buffer, and if this buffer gets filled, the OS tells the application that it has only done a partial send. The bug is that it is up to the caller, i.e. the application, to attempt to re-send those bits.
Workaround
setsockopt()
to make its buffer biggerFix Basically, the problem is this:
Lidgren must attempt to re-send any bytes that didn't get sent as a result of an incomplete
SendTo()
.