On this line, only keys present in the selected key set are registered in the new selector:
|
selectedKeys.filter(!readableKeys.contains(_)).foreach(key => { |
However, a selection key is added to the selected key set only once its channel becomes ready for an I/O operation. Therefore, if a socket is not yet ready (I suspect, most of the time, this is true for any other open socket connection in the world), it won't be in that set and so won't be registered in the new selector.
Suggested change:
selector.keys.filter(!readableKeys.contains(_)).foreach(key => {
On this line, only keys present in the selected key set are registered in the new selector:
OpenComputers/src/main/scala/li/cil/oc/server/component/InternetCard.scala
Line 212 in de8f207
However, a selection key is added to the selected key set only once its channel becomes ready for an I/O operation. Therefore, if a socket is not yet ready (I suspect, most of the time, this is true for any other open socket connection in the world), it won't be in that set and so won't be registered in the new selector.
Suggested change: