312 SelectionKeyImpl sk) { |
312 SelectionKeyImpl sk) { |
313 int intOps = sk.nioInterestOps(); |
313 int intOps = sk.nioInterestOps(); |
314 int oldOps = sk.nioReadyOps(); |
314 int oldOps = sk.nioReadyOps(); |
315 int newOps = initialOps; |
315 int newOps = initialOps; |
316 |
316 |
317 if ((ops & PollArrayWrapper.POLLNVAL) != 0) { |
317 if ((ops & Net.POLLNVAL) != 0) { |
318 /* This should only happen if this channel is pre-closed while a |
318 /* This should only happen if this channel is pre-closed while a |
319 * selection operation is in progress |
319 * selection operation is in progress |
320 * ## Throw an error if this channel has not been pre-closed */ |
320 * ## Throw an error if this channel has not been pre-closed */ |
321 return false; |
321 return false; |
322 } |
322 } |
323 |
323 |
324 if ((ops & (PollArrayWrapper.POLLERR |
324 if ((ops & (Net.POLLERR | Net.POLLHUP)) != 0) { |
325 | PollArrayWrapper.POLLHUP)) != 0) { |
|
326 newOps = intOps; |
325 newOps = intOps; |
327 sk.nioReadyOps(newOps); |
326 sk.nioReadyOps(newOps); |
328 return (newOps & ~oldOps) != 0; |
327 return (newOps & ~oldOps) != 0; |
329 } |
328 } |
330 |
329 |
331 if (((ops & PollArrayWrapper.POLLIN) != 0) && |
330 if (((ops & Net.POLLIN) != 0) && |
332 ((intOps & SelectionKey.OP_ACCEPT) != 0)) |
331 ((intOps & SelectionKey.OP_ACCEPT) != 0)) |
333 newOps |= SelectionKey.OP_ACCEPT; |
332 newOps |= SelectionKey.OP_ACCEPT; |
334 |
333 |
335 sk.nioReadyOps(newOps); |
334 sk.nioReadyOps(newOps); |
336 return (newOps & ~oldOps) != 0; |
335 return (newOps & ~oldOps) != 0; |
350 public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) { |
349 public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) { |
351 int newOps = 0; |
350 int newOps = 0; |
352 |
351 |
353 /* Translate ops */ |
352 /* Translate ops */ |
354 if ((ops & SelectionKey.OP_ACCEPT) != 0) |
353 if ((ops & SelectionKey.OP_ACCEPT) != 0) |
355 newOps |= PollArrayWrapper.POLLIN; |
354 newOps |= Net.POLLIN; |
356 /* Place ops into pollfd array */ |
355 /* Place ops into pollfd array */ |
357 sk.selector.putEventOps(sk, newOps); |
356 sk.selector.putEventOps(sk, newOps); |
358 |
357 |
359 } |
358 } |
360 |
359 |