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)
|
serverChannel.register(selector, OP_ACCEPT, null)
|
||||||
|
|
||||||
while (selector.isOpen) {
|
while (selector.isOpen) {
|
||||||
|
try {
|
||||||
selector.select(1000)
|
selector.select(1000)
|
||||||
val keyIterator = selector.selectedKeys().iterator()
|
val keyIterator = selector.selectedKeys().iterator()
|
||||||
while (keyIterator.hasNext()) {
|
while (keyIterator.hasNext()) {
|
||||||
@ -271,6 +272,9 @@ class NioNetworkHandler : NetworkHandler, InternalContext.ContextHolder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: CancelledKeyException) {
|
||||||
|
LOG.debug(e.message, e)
|
||||||
|
}
|
||||||
// set interest ops
|
// set interest ops
|
||||||
for ((connection, selectionKey) in connections) {
|
for ((connection, selectionKey) in connections) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user