MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.

Home Page:https://oc.cil.li

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internet card selector update logic erroneously drops non-ready keys

Fingercomp opened this issue · comments

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 => { 

Having seen your work on Ocelot, I'm confident that you have a better idea of how this part of the code works than I do. :-)

Consider submitting a PR next time, but this will do! Thank you!