jetty-9 removed race with NPN replacing connection and extra wrap causing NPE in SSLEngineImpl

This commit is contained in:
Greg Wilkins 2012-10-02 15:00:31 -07:00
parent 6cc0734a1a
commit 97d08c399a
3 changed files with 9 additions and 3 deletions

View File

@ -1,2 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.LEVEL=INFO org.eclipse.jetty.LEVEL=INFO

View File

@ -1,3 +1,5 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
#org.eclipse.jetty.spdy.LEVEL=DEBUG #org.eclipse.jetty.spdy.LEVEL=DEBUG
#org.eclipse.jetty.server.LEVEL=DEBUG #org.eclipse.jetty.server.LEVEL=DEBUG
#org.eclipse.jetty.io.ssl.LEVEL=DEBUG
#org.eclipse.jetty.spdy.server.LEVEL=DEBUG

View File

@ -35,7 +35,7 @@ import org.eclipse.jetty.util.log.Logger;
public class NextProtoNegoServerConnection extends AbstractConnection implements NextProtoNego.ServerProvider public class NextProtoNegoServerConnection extends AbstractConnection implements NextProtoNego.ServerProvider
{ {
private final Logger logger = Log.getLogger(getClass()); private final Logger LOG = Log.getLogger(getClass());
private final Connector connector; private final Connector connector;
private final SSLEngine engine; private final SSLEngine engine;
private final List<String> protocols; private final List<String> protocols;
@ -78,6 +78,9 @@ public class NextProtoNegoServerConnection extends AbstractConnection implements
if (filled <= 0 || completed) if (filled <= 0 || completed)
break; break;
} }
if (completed)
getEndPoint().getConnection().onOpen();
} }
private int fill() private int fill()
@ -88,7 +91,7 @@ public class NextProtoNegoServerConnection extends AbstractConnection implements
} }
catch (IOException x) catch (IOException x)
{ {
logger.debug(x); LOG.debug(x);
getEndPoint().close(); getEndPoint().close();
return -1; return -1;
} }
@ -109,13 +112,13 @@ public class NextProtoNegoServerConnection extends AbstractConnection implements
@Override @Override
public void protocolSelected(String protocol) public void protocolSelected(String protocol)
{ {
LOG.debug("{} protocolSelected {}",this,protocol);
NextProtoNego.remove(engine); NextProtoNego.remove(engine);
ConnectionFactory connectionFactory = connector.getConnectionFactory(protocol); ConnectionFactory connectionFactory = connector.getConnectionFactory(protocol);
EndPoint endPoint = getEndPoint(); EndPoint endPoint = getEndPoint();
endPoint.getConnection().onClose(); endPoint.getConnection().onClose();
Connection connection = connectionFactory.newConnection(connector, endPoint); Connection connection = connectionFactory.newConnection(connector, endPoint);
endPoint.setConnection(connection); endPoint.setConnection(connection);
connection.onOpen();
completed = true; completed = true;
} }
} }