Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only waitReadable if errno was EAGAINish
This code previously assumed that all -1 return values from read meant EAGAIN and that we should proceed to selection. If the read result was actually equivalent to EAGAIN, this was correct. If the read result was some other error, we still would proceed to the selection, and in most cases the same or similar error would be raised at that point. However at least one particular case: a "Connection reset" event caused by the other end sending RST (due in this case to SO_LINGER=0), the selection operation did *not* raise any error, and appeared to be readable. As a result we went back to the read, another "Connection reset" was triggered, we assumed it was EAGAIN, and so on. This commit checks the errno for exactly matching EAGAIN or EWOULDBLOCK before performing the selection, otherwise raising an error for the failed read. Fixes jruby#7961
- Loading branch information