提交 18d4d3bc 编写于 作者: C chegar

7016898: PlainSocketImpl.fd is null on Windows

Reviewed-by: alanb
上级 5f9cb587
...@@ -138,6 +138,9 @@ class PlainSocketImpl extends AbstractPlainSocketImpl ...@@ -138,6 +138,9 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
protected synchronized void create(boolean stream) throws IOException { protected synchronized void create(boolean stream) throws IOException {
impl.create(stream); impl.create(stream);
// set fd to delegate's fd to be compatible with older releases
this.fd = impl.fd;
} }
protected void connect(String host, int port) protected void connect(String host, int port)
...@@ -174,9 +177,13 @@ class PlainSocketImpl extends AbstractPlainSocketImpl ...@@ -174,9 +177,13 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
protected synchronized void accept(SocketImpl s) throws IOException { protected synchronized void accept(SocketImpl s) throws IOException {
// pass in the real impl not the wrapper. // pass in the real impl not the wrapper.
((PlainSocketImpl)s).impl.address = new InetAddress(); SocketImpl delegate = ((PlainSocketImpl)s).impl;
((PlainSocketImpl)s).impl.fd = new FileDescriptor(); delegate.address = new InetAddress();
impl.accept(((PlainSocketImpl)s).impl); delegate.fd = new FileDescriptor();
impl.accept(delegate);
// set fd to delegate's fd to be compatible with older releases
s.fd = delegate.fd;
} }
void setFileDescriptor(FileDescriptor fd) { void setFileDescriptor(FileDescriptor fd) {
...@@ -208,11 +215,21 @@ class PlainSocketImpl extends AbstractPlainSocketImpl ...@@ -208,11 +215,21 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
} }
protected void close() throws IOException { protected void close() throws IOException {
try {
impl.close(); impl.close();
} finally {
// set fd to delegate's fd to be compatible with older releases
this.fd = null;
}
} }
void reset() throws IOException { void reset() throws IOException {
try {
impl.reset(); impl.reset();
} finally {
// set fd to delegate's fd to be compatible with older releases
this.fd = null;
}
} }
protected void shutdownInput() throws IOException { protected void shutdownInput() throws IOException {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册