author | alanb |
Fri, 14 Sep 2018 16:56:09 +0100 | |
changeset 51745 | 90c1dcdebc64 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
5983
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
1 |
/* |
44414
06222fd091b4
8177559: Enable java/nio/channels/Selector/OutOfBand.java for macOS >= 10.10.5
bpb
parents:
5983
diff
changeset
|
2 |
* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. |
5983
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
4 |
* |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
8 |
* |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
13 |
* accompanied this code). |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
14 |
* |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
18 |
* |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
21 |
* questions. |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
22 |
*/ |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
23 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
24 |
/* @test |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
25 |
* @bug 6213702 |
44414
06222fd091b4
8177559: Enable java/nio/channels/Selector/OutOfBand.java for macOS >= 10.10.5
bpb
parents:
5983
diff
changeset
|
26 |
* @requires (os.family != "mac") | (os.version == "10.10.5") |
06222fd091b4
8177559: Enable java/nio/channels/Selector/OutOfBand.java for macOS >= 10.10.5
bpb
parents:
5983
diff
changeset
|
27 |
* | (os.simpleVersion != "10.8" & os.simpleVersion != "10.9" |
06222fd091b4
8177559: Enable java/nio/channels/Selector/OutOfBand.java for macOS >= 10.10.5
bpb
parents:
5983
diff
changeset
|
28 |
* & os.simpleVersion != "10.10") |
5983
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
29 |
* @summary OOB data causes a SocketChannel, with OOBINLINE disabled, to be |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
30 |
* selected |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
31 |
*/ |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
32 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
33 |
import java.net.*; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
34 |
import java.nio.ByteBuffer; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
35 |
import java.nio.channels.*; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
36 |
import java.io.IOException; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
37 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
38 |
public class OutOfBand { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
39 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
40 |
public static void main(String[] args) throws Exception { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
41 |
ServerSocketChannel ssc = null; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
42 |
SocketChannel sc = null; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
43 |
Selector sel = null; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
44 |
Socket s = null; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
45 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
46 |
try { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
47 |
// establish loopback connection. |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
48 |
ssc = ServerSocketChannel.open().bind(new InetSocketAddress(0)); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
49 |
s = new Socket(InetAddress.getLocalHost(), |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
50 |
ssc.socket().getLocalPort()); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
51 |
sc = ssc.accept(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
52 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
53 |
sel = Selector.open(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
54 |
sc.configureBlocking(false); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
55 |
sc.register(sel, SelectionKey.OP_READ); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
56 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
57 |
// OOB data should be disabled by default |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
58 |
if (sc.socket().getOOBInline()) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
59 |
throw new RuntimeException("SO_OOBINLINE enabled"); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
60 |
test(s, false, 0, 0, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
61 |
test(s, false, 512, 0, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
62 |
test(s, false, 0, 512, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
63 |
test(s, false, 512, 512, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
64 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
65 |
// enable SO_OOBINLINE |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
66 |
sc.socket().setOOBInline(true); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
67 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
68 |
// OOB data should be received |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
69 |
test(s, true, 0, 0, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
70 |
test(s, true, 512, 0, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
71 |
test(s, true, 0, 512, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
72 |
test(s, true, 512, 512, sel); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
73 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
74 |
} finally { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
75 |
if (sel != null) sel.close(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
76 |
if (sc != null) sc.close(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
77 |
if (ssc != null) ssc.close(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
78 |
if (s != null) sc.close(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
79 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
80 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
81 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
82 |
static void test(Socket s, boolean urgentExpected, |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
83 |
int bytesBefore, int bytesAfter, |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
84 |
Selector sel) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
85 |
throws IOException |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
86 |
{ |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
87 |
// send data |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
88 |
int bytesExpected = 0; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
89 |
if (bytesBefore > 0) { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
90 |
s.getOutputStream().write(new byte[bytesBefore]); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
91 |
bytesExpected += bytesBefore; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
92 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
93 |
s.sendUrgentData(0xff); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
94 |
if (urgentExpected) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
95 |
bytesExpected++; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
96 |
if (bytesAfter > 0) { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
97 |
s.getOutputStream().write(new byte[bytesAfter]); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
98 |
bytesExpected += bytesAfter; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
99 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
100 |
|
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
101 |
// receive data, checking for spurious wakeups and reads |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
102 |
int spuriousWakeups = 0; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
103 |
int spuriousReads = 0; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
104 |
int bytesRead = 0; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
105 |
ByteBuffer bb = ByteBuffer.allocate(100); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
106 |
for (;;) { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
107 |
int n = sel.select(2000); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
108 |
if (n == 0) { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
109 |
if (bytesRead == bytesExpected) { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
110 |
System.out.format("Selector wakeups %d\tSpurious reads %d%n", |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
111 |
spuriousWakeups, spuriousReads); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
112 |
return; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
113 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
114 |
if (++spuriousWakeups >= 3) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
115 |
throw new RuntimeException("Selector appears to be spinning" + |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
116 |
" or data not received"); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
117 |
continue; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
118 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
119 |
if (n > 1) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
120 |
throw new RuntimeException("More than one key selected????"); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
121 |
SelectionKey key = sel.selectedKeys().iterator().next(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
122 |
bb.clear(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
123 |
n = ((SocketChannel)key.channel()).read(bb); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
124 |
if (n == 0) { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
125 |
if (++spuriousReads >=3) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
126 |
throw new RuntimeException("Too many spurious reads"); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
127 |
} else { |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
128 |
bytesRead += n; |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
129 |
if (bytesRead > bytesExpected) |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
130 |
throw new RuntimeException("Received more than expected"); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
131 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
132 |
sel.selectedKeys().clear(); |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
133 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
134 |
} |
b5bc332cd233
6213702: (so) non-blocking sockets with TCP urgent disabled get still selected for read ops (win)
alanb
parents:
diff
changeset
|
135 |
} |