mirror of
https://github.com/corda/corda.git
synced 2025-01-08 14:03:06 +00:00
fix regression in SocketSelector when selecting ServerSocketChannels
This commit is contained in:
parent
6fa25f992c
commit
fb40b046fd
@ -16,6 +16,8 @@ import java.nio.ByteBuffer;
|
|||||||
public abstract class SelectableChannel implements Channel {
|
public abstract class SelectableChannel implements Channel {
|
||||||
private SelectionKey key;
|
private SelectionKey key;
|
||||||
|
|
||||||
|
abstract int socketFD();
|
||||||
|
|
||||||
public abstract SelectableChannel configureBlocking(boolean v)
|
public abstract SelectableChannel configureBlocking(boolean v)
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
|
||||||
|
@ -23,6 +23,10 @@ public class ServerSocketChannel extends SelectableChannel {
|
|||||||
return new ServerSocketChannel();
|
return new ServerSocketChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int socketFD() {
|
||||||
|
return channel.socketFD();
|
||||||
|
}
|
||||||
|
|
||||||
public SelectableChannel configureBlocking(boolean v) throws IOException {
|
public SelectableChannel configureBlocking(boolean v) throws IOException {
|
||||||
return channel.configureBlocking(v);
|
return channel.configureBlocking(v);
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ class SocketSelector extends Selector {
|
|||||||
it.hasNext();)
|
it.hasNext();)
|
||||||
{
|
{
|
||||||
SelectionKey key = it.next();
|
SelectionKey key = it.next();
|
||||||
SocketChannel c = (SocketChannel)key.channel();
|
SelectableChannel c = key.channel();
|
||||||
int socket = c.socketFD();
|
int socket = c.socketFD();
|
||||||
if (c.isOpen()) {
|
if (c.isOpen()) {
|
||||||
key.readyOps(0);
|
key.readyOps(0);
|
||||||
@ -88,7 +88,7 @@ class SocketSelector extends Selector {
|
|||||||
|
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
for (SelectionKey key : keys) {
|
for (SelectionKey key : keys) {
|
||||||
SocketChannel c = (SocketChannel)key.channel();
|
SelectableChannel c = key.channel();
|
||||||
int socket = c.socketFD();
|
int socket = c.socketFD();
|
||||||
int ready = natUpdateReadySet(socket, key.interestOps(), state);
|
int ready = natUpdateReadySet(socket, key.interestOps(), state);
|
||||||
key.readyOps(ready);
|
key.readyOps(ready);
|
||||||
|
Loading…
Reference in New Issue
Block a user