mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8147862: Null check too late in sun.net.httpserver.ServerImpl
Reviewed-by: chegar
This commit is contained in:
parent
0e9196c50f
commit
1cbdf12c05
1 changed files with 15 additions and 15 deletions
|
@ -373,22 +373,22 @@ class ServerImpl implements TimeSource {
|
||||||
}
|
}
|
||||||
SocketChannel chan = schan.accept();
|
SocketChannel chan = schan.accept();
|
||||||
|
|
||||||
|
// optimist there's a channel
|
||||||
|
if (chan != null) {
|
||||||
// Set TCP_NODELAY, if appropriate
|
// Set TCP_NODELAY, if appropriate
|
||||||
if (ServerConfig.noDelay()) {
|
if (ServerConfig.noDelay()) {
|
||||||
chan.socket().setTcpNoDelay(true);
|
chan.socket().setTcpNoDelay(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan == null) {
|
|
||||||
continue; /* cancel something ? */
|
|
||||||
}
|
|
||||||
chan.configureBlocking (false);
|
chan.configureBlocking (false);
|
||||||
SelectionKey newkey = chan.register (selector, SelectionKey.OP_READ);
|
SelectionKey newkey =
|
||||||
|
chan.register (selector, SelectionKey.OP_READ);
|
||||||
HttpConnection c = new HttpConnection ();
|
HttpConnection c = new HttpConnection ();
|
||||||
c.selectionKey = newkey;
|
c.selectionKey = newkey;
|
||||||
c.setChannel (chan);
|
c.setChannel (chan);
|
||||||
newkey.attach (c);
|
newkey.attach (c);
|
||||||
requestStarted (c);
|
requestStarted (c);
|
||||||
allConnections.add (c);
|
allConnections.add (c);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (key.isReadable()) {
|
if (key.isReadable()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue