Added guard against multiple closes: if the endPoint is already closed, skip updating the SSLEngine and/or the endPoint.

This commit is contained in:
Simone Bordet 2011-12-12 16:57:14 +01:00
parent 2c650a5fdd
commit 416b6a8a15
1 changed files with 4 additions and 8 deletions

View File

@ -16,7 +16,6 @@ package org.eclipse.jetty.io.nio;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult; import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLEngineResult.HandshakeStatus; import javax.net.ssl.SSLEngineResult.HandshakeStatus;
@ -381,9 +380,10 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
} }
// pass on ishut/oshut state // pass on ishut/oshut state
if (!_inbound.hasContent() && _endp.isInputShutdown()) if (_endp.isOpen() && _endp.isInputShutdown() && !_inbound.hasContent())
_engine.closeInbound(); _engine.closeInbound();
if (!_outbound.hasContent() && _engine.isOutboundDone())
if (_endp.isOpen() && _engine.isOutboundDone() && !_outbound.hasContent())
_endp.shutdownOutput(); _endp.shutdownOutput();
some_progress|=progress; some_progress|=progress;
@ -570,11 +570,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
public String toString() public String toString()
{ {
Buffer i=_inbound; return String.format("%s | %s", super.toString(), _sslEndPoint);
Buffer o=_outbound;
Buffer u=_unwrapBuf;
return super.toString()+"|"+_engine.getHandshakeStatus()+" i/u/o="+(i==null?0:i.length())+"/"+(u==null?0:u.length())+"/"+(o==null?0:o.length());
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */