364921 moved setCheckForIdle handling to AsyncHttpConnection
This commit is contained in:
parent
ef23bf11b8
commit
b99e03c465
|
@ -1241,7 +1241,6 @@ public class SslBytesServerTest extends SslBytesTest
|
|||
closeClient(client);
|
||||
}
|
||||
|
||||
@Ignore // TODO: currently not passing
|
||||
@Test
|
||||
public void testServerShutdownOutputClientDoesNotCloseServerCloses() throws Exception
|
||||
{
|
||||
|
@ -1291,11 +1290,9 @@ public class SslBytesServerTest extends SslBytesTest
|
|||
// The server has shutdown the output since the client sent a Connection: close
|
||||
// but the client does not close, so the server must idle timeout the endPoint.
|
||||
|
||||
TimeUnit.MILLISECONDS.sleep(idleTimeout + idleTimeout / 2);
|
||||
TimeUnit.MILLISECONDS.sleep(idleTimeout + idleTimeout/2);
|
||||
|
||||
Assert.assertFalse(serverEndPoint.get().isOpen());
|
||||
|
||||
closeClient(client);
|
||||
}
|
||||
|
||||
private void assumeJavaVersionSupportsTLSRenegotiations()
|
||||
|
|
|
@ -257,15 +257,6 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
getSelectSet().scheduleTimeout(task,timeoutMs);
|
||||
}
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
@Override
|
||||
public boolean isOutputShutdown()
|
||||
{
|
||||
setCheckForIdle(true);
|
||||
return super.isOutputShutdown();
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
public void setCheckForIdle(boolean check)
|
||||
{
|
||||
|
@ -289,10 +280,11 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
public void checkIdleTimestamp(long now)
|
||||
{
|
||||
long idleTimestamp=_idleTimestamp;
|
||||
|
||||
|
||||
if (idleTimestamp!=0 && _maxIdleTime>0)
|
||||
{
|
||||
long idleForMs=now-idleTimestamp;
|
||||
|
||||
if (idleForMs>_maxIdleTime)
|
||||
{
|
||||
onIdleExpired(idleForMs);
|
||||
|
|
|
@ -599,6 +599,7 @@ public class SslConnection extends AbstractConnection implements AsyncConnection
|
|||
|
||||
public void shutdownOutput() throws IOException
|
||||
{
|
||||
System.err.println("OSHUT SSL");
|
||||
synchronized (SslConnection.this)
|
||||
{
|
||||
LOG.debug("{} ssl endp.oshut {}",_session,this);
|
||||
|
|
|
@ -54,6 +54,10 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
|
|||
try
|
||||
{
|
||||
setCurrentConnection(this);
|
||||
|
||||
// don't check for idle while dispatched (unless blocking IO is done).
|
||||
_asyncEndp.setCheckForIdle(false);
|
||||
|
||||
|
||||
// While progress and the connection has not changed
|
||||
while (progress && connection==this)
|
||||
|
@ -133,10 +137,16 @@ public class AsyncHttpConnection extends AbstractHttpConnection implements Async
|
|||
finally
|
||||
{
|
||||
setCurrentConnection(null);
|
||||
|
||||
// If we are not suspended
|
||||
if (!_request.isAsyncStarted())
|
||||
{
|
||||
// return buffers
|
||||
_parser.returnBuffers();
|
||||
_generator.returnBuffers();
|
||||
|
||||
// resuming checking for idle
|
||||
_asyncEndp.setCheckForIdle(true);
|
||||
}
|
||||
|
||||
// Safety net to catch spinning
|
||||
|
|
|
@ -122,7 +122,6 @@ public class SelectChannelConnector extends AbstractNIOConnector
|
|||
public void customize(EndPoint endpoint, Request request) throws IOException
|
||||
{
|
||||
AsyncEndPoint aEndp = ((AsyncEndPoint)endpoint);
|
||||
aEndp.setCheckForIdle(false);
|
||||
request.setTimeStamp(System.currentTimeMillis());
|
||||
endpoint.setMaxIdleTime(_maxIdleTime);
|
||||
super.customize(endpoint, request);
|
||||
|
|
Loading…
Reference in New Issue