forked from netty/netty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set readPending to false when ever a read is done
Motivation: readPending is currently only set to false if data is delivered to the application, however this may result in duplicate events being received from the selector in the event that the socket was closed. Modifications: - We should set readPending to false before each read attempt for all transports besides NIO. - Based upon the Javadocs it is possible that NIO may have spurious wakeups [1]. In this case we should be more cautious and only set readPending to false if data was actually read. [1] https://docs.oracle.com/javase/7/docs/api/java/nio/channels/SelectionKey.html That a selection key's ready set indicates that its channel is ready for some operation category is a hint, but not a guarantee, that an operation in such a category may be performed by a thread without causing the thread to block. Result: Notification from the selector (or simulated events from kqueue/epoll ET) in the event of socket closure. Fixes netty#7255
- Loading branch information
1 parent
424bb09
commit 413c7c2
Showing
4 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters