gentler SSL close

This commit is contained in:
Greg Wilkins 2011-10-11 16:05:17 +11:00
parent 4149ff4d21
commit 06f4ada935
1 changed files with 7 additions and 3 deletions

View File

@ -242,7 +242,10 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
if (_closing) if (_closing)
{ {
if (outBuf!=null && outBuf.hasContent()) if (outBuf!=null && outBuf.hasContent())
throw new IOException("Write while closing"); {
LOG.debug("Write while closing");
outBuf.clear();
}
break; break;
} }
@ -317,7 +320,7 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
// Need more data to be unwrapped so try another call to unwrap // Need more data to be unwrapped so try another call to unwrap
progress|=unwrap(inBBuf); progress|=unwrap(inBBuf);
if (_closing) if (_closing && inBBuf.hasRemaining())
inBBuf.clear(); inBBuf.clear();
break; break;
} }
@ -643,7 +646,8 @@ public class SslSelectChannelEndPoint extends SelectChannelEndPoint
catch(SSLException e) catch(SSLException e)
{ {
LOG.warn(getRemoteAddr()+":"+getRemotePort()+" ",e); LOG.warn(getRemoteAddr()+":"+getRemotePort()+" ",e);
super.close(); if (getChannel().isOpen())
getChannel().close();
throw e; throw e;
} }
finally finally