Fixed occasional on the selector - it shouldn't crash the application
This commit is contained in:
parent
6c04aa683e
commit
d9e52c85c3
@ -203,6 +203,7 @@ class NioNetworkHandler : NetworkHandler, InternalContext.ContextHolder {
|
||||
serverChannel.register(selector, OP_ACCEPT, null)
|
||||
|
||||
while (selector.isOpen) {
|
||||
try {
|
||||
selector.select(1000)
|
||||
val keyIterator = selector.selectedKeys().iterator()
|
||||
while (keyIterator.hasNext()) {
|
||||
@ -271,6 +272,9 @@ class NioNetworkHandler : NetworkHandler, InternalContext.ContextHolder {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: CancelledKeyException) {
|
||||
LOG.debug(e.message, e)
|
||||
}
|
||||
// set interest ops
|
||||
for ((connection, selectionKey) in connections) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user