mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8201474: (so) Socket adaptor connect(InetAddress, timeout) succeeds when connection fails
Reviewed-by: bpb
This commit is contained in:
parent
85fbf32898
commit
45fb75c85a
5 changed files with 46 additions and 16 deletions
|
@ -1280,8 +1280,8 @@ class DatagramChannelImpl
|
|||
boolean polled = false;
|
||||
try {
|
||||
beginRead(blocking, false);
|
||||
int n = Net.poll(fd, Net.POLLIN, timeout);
|
||||
polled = (n > 0);
|
||||
int events = Net.poll(fd, Net.POLLIN, timeout);
|
||||
polled = (events != 0);
|
||||
} finally {
|
||||
endRead(blocking, polled);
|
||||
}
|
||||
|
|
|
@ -431,8 +431,8 @@ class ServerSocketChannelImpl
|
|||
boolean polled = false;
|
||||
try {
|
||||
begin(true);
|
||||
int n = Net.poll(fd, Net.POLLIN, timeout);
|
||||
polled = (n > 0);
|
||||
int events = Net.poll(fd, Net.POLLIN, timeout);
|
||||
polled = (events != 0);
|
||||
} finally {
|
||||
end(true, polled);
|
||||
}
|
||||
|
|
|
@ -951,8 +951,8 @@ class SocketChannelImpl
|
|||
boolean polled = false;
|
||||
try {
|
||||
beginRead(blocking);
|
||||
int n = Net.poll(fd, Net.POLLIN, timeout);
|
||||
polled = (n > 0);
|
||||
int events = Net.poll(fd, Net.POLLIN, timeout);
|
||||
polled = (events != 0);
|
||||
} finally {
|
||||
endRead(blocking, polled);
|
||||
}
|
||||
|
@ -977,10 +977,13 @@ class SocketChannelImpl
|
|||
boolean polled = false;
|
||||
try {
|
||||
beginFinishConnect(blocking);
|
||||
int n = Net.poll(fd, Net.POLLCONN, timeout);
|
||||
polled = (n > 0);
|
||||
int events = Net.poll(fd, Net.POLLCONN, timeout);
|
||||
polled = (events != 0);
|
||||
} finally {
|
||||
endFinishConnect(blocking, polled);
|
||||
// invoke endFinishConnect with completed = false so that
|
||||
// the state is not changed to ST_CONNECTED. The socket
|
||||
// adaptor will use finishConnect to finish.
|
||||
endFinishConnect(blocking, /*completed*/false);
|
||||
}
|
||||
return polled;
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue