Improved handling of connection close, in case a request gets no response because the connection has been closed.
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2921 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
7dfec125f2
commit
05c3f0338d
|
@ -77,7 +77,7 @@ public class HttpConnection /* extends AbstractConnection */ implements Connecti
|
||||||
{
|
{
|
||||||
_endp=endp;
|
_endp=endp;
|
||||||
_timeStamp = System.currentTimeMillis();
|
_timeStamp = System.currentTimeMillis();
|
||||||
|
|
||||||
_generator = new HttpGenerator(requestBuffers,endp);
|
_generator = new HttpGenerator(requestBuffers,endp);
|
||||||
_parser = new HttpParser(responseBuffers,endp,new Handler());
|
_parser = new HttpParser(responseBuffers,endp,new Handler());
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,7 @@ public class HttpConnection /* extends AbstractConnection */ implements Connecti
|
||||||
no_progress = 0;
|
no_progress = 0;
|
||||||
commitRequest();
|
commitRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
long io = 0;
|
long io = 0;
|
||||||
_endp.flush();
|
_endp.flush();
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ public class HttpConnection /* extends AbstractConnection */ implements Connecti
|
||||||
throw (ThreadDeath)e;
|
throw (ThreadDeath)e;
|
||||||
|
|
||||||
failed = true;
|
failed = true;
|
||||||
|
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
{
|
{
|
||||||
if (_exchange != null)
|
if (_exchange != null)
|
||||||
|
@ -337,15 +337,18 @@ public class HttpConnection /* extends AbstractConnection */ implements Connecti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO - this needs to be greatly improved.
|
// TODO - this needs to be greatly improved.
|
||||||
if (_endp.isOpen() && _endp.isInputShutdown() && _generator.isComplete())
|
if (_generator.isComplete() && !_parser.isComplete())
|
||||||
{
|
{
|
||||||
complete=true;
|
if (!_endp.isOpen() || _endp.isInputShutdown())
|
||||||
close=true;
|
{
|
||||||
close();
|
complete=true;
|
||||||
|
close=true;
|
||||||
|
close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (complete || failed)
|
if (complete || failed)
|
||||||
{
|
{
|
||||||
synchronized (this)
|
synchronized (this)
|
||||||
|
@ -360,12 +363,10 @@ public class HttpConnection /* extends AbstractConnection */ implements Connecti
|
||||||
{
|
{
|
||||||
HttpExchange exchange=_exchange;
|
HttpExchange exchange=_exchange;
|
||||||
_exchange.disassociate();
|
_exchange.disassociate();
|
||||||
|
|
||||||
|
|
||||||
if (_exchange.getTimeout()>0 && _exchange.getTimeout()!=getDestination().getHttpClient().getTimeout())
|
if (_exchange.getTimeout()>0 && _exchange.getTimeout()!=getDestination().getHttpClient().getTimeout())
|
||||||
_endp.setMaxIdleTime((int)getDestination().getHttpClient().getTimeout());
|
_endp.setMaxIdleTime((int)getDestination().getHttpClient().getTimeout());
|
||||||
_exchange = null;
|
_exchange = null;
|
||||||
|
|
||||||
|
|
||||||
if (_status==HttpStatus.SWITCHING_PROTOCOLS_101)
|
if (_status==HttpStatus.SWITCHING_PROTOCOLS_101)
|
||||||
{
|
{
|
||||||
|
@ -720,7 +721,7 @@ public class HttpConnection /* extends AbstractConnection */ implements Connecti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// TODO remove and use AbstractConnection for 7.4
|
// TODO remove and use AbstractConnection for 7.4
|
||||||
|
|
Loading…
Reference in New Issue