* Fix Exceptions in EventHandler#postHandling Breaking Select Loop * We can run into the `write` path for SSL channels when they are not fully registered (if registration fails and a close message is attempted to be written) and thus into NPEs from missing selection keys * This is a quick fix to quiet down tests, a cleaner solution will be incoming for #44343 * Relates #44343
This commit is contained in:
parent
099d52f3b0
commit
5c8275cd2c
|
@ -180,9 +180,15 @@ public class EventHandler {
|
||||||
closeException(context, e);
|
closeException(context, e);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SelectionKey selectionKey = context.getSelectionKey();
|
|
||||||
boolean currentlyWriteInterested = SelectionKeyUtils.isWriteInterested(selectionKey);
|
|
||||||
boolean pendingWrites = context.readyForFlush();
|
boolean pendingWrites = context.readyForFlush();
|
||||||
|
SelectionKey selectionKey = context.getSelectionKey();
|
||||||
|
if (selectionKey == null) {
|
||||||
|
if (pendingWrites) {
|
||||||
|
writeException(context, new IllegalStateException("Tried to write to an not yet registered channel"));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean currentlyWriteInterested = SelectionKeyUtils.isWriteInterested(selectionKey);
|
||||||
if (currentlyWriteInterested == false && pendingWrites) {
|
if (currentlyWriteInterested == false && pendingWrites) {
|
||||||
SelectionKeyUtils.setWriteInterested(selectionKey);
|
SelectionKeyUtils.setWriteInterested(selectionKey);
|
||||||
} else if (currentlyWriteInterested && pendingWrites == false) {
|
} else if (currentlyWriteInterested && pendingWrites == false) {
|
||||||
|
|
Loading…
Reference in New Issue