mirror of
https://github.com/corda/corda.git
synced 2025-06-14 21:28:14 +00:00
add minimal java.net.Socket implementation to support Socket.setTcpNoDelay
This commit is contained in:
@ -16,11 +16,21 @@ import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
|
||||
public class ServerSocketChannel extends SocketChannel {
|
||||
public class ServerSocketChannel extends SelectableChannel {
|
||||
private final SocketChannel channel = new SocketChannel();
|
||||
|
||||
public static ServerSocketChannel open() {
|
||||
return new ServerSocketChannel();
|
||||
}
|
||||
|
||||
public SelectableChannel configureBlocking(boolean v) {
|
||||
return channel.configureBlocking(v);
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
channel.close();
|
||||
}
|
||||
|
||||
public SocketChannel accept() throws Exception {
|
||||
SocketChannel c = new SocketChannel();
|
||||
c.socket = doAccept();
|
||||
@ -33,7 +43,7 @@ public class ServerSocketChannel extends SocketChannel {
|
||||
}
|
||||
|
||||
private int doAccept() throws IOException {
|
||||
return natDoAccept(socket);
|
||||
return natDoAccept(channel.socket);
|
||||
}
|
||||
|
||||
private int doListen(String host, int port) throws IOException {
|
||||
@ -50,7 +60,7 @@ public class ServerSocketChannel extends SocketChannel {
|
||||
} catch (ClassCastException e) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
socket = doListen(a.getHostName(), a.getPort());
|
||||
channel.socket = doListen(a.getHostName(), a.getPort());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user