#296650 JETTY-1198 reset idle timeout on request body chunks

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1654 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-05-03 18:52:16 +00:00
parent 8eac789ca1
commit d994f2db2d
6 changed files with 28 additions and 1 deletions

View File

@ -1,4 +1,5 @@
jetty-7.1.0.RC1-SNAPSHOT jetty-7.1.0.RC1-SNAPSHOT
+ 296650 JETTY-1198 reset idle timeout on request body chunks
+ 291448 SessionManager has isCheckingRemoteSessionIdEncoding + 291448 SessionManager has isCheckingRemoteSessionIdEncoding
+ 297104 HTTP CONNECT does not work correct with SSL destinations + 297104 HTTP CONNECT does not work correct with SSL destinations
+ 308848 Update test suite to JUnit4 - Module jetty-ajp + 308848 Update test suite to JUnit4 - Module jetty-ajp

View File

@ -549,6 +549,8 @@ public class HttpConnection implements Connection
@Override @Override
public void headerComplete() throws IOException public void headerComplete() throws IOException
{ {
if (_endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleIdle();
HttpExchange exchange = _exchange; HttpExchange exchange = _exchange;
if (exchange!=null) if (exchange!=null)
exchange.setStatus(HttpExchange.STATUS_PARSING_CONTENT); exchange.setStatus(HttpExchange.STATUS_PARSING_CONTENT);
@ -557,6 +559,8 @@ public class HttpConnection implements Connection
@Override @Override
public void content(Buffer ref) throws IOException public void content(Buffer ref) throws IOException
{ {
if (_endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleIdle();
HttpExchange exchange = _exchange; HttpExchange exchange = _exchange;
if (exchange!=null) if (exchange!=null)
exchange.getEventListener().onResponseContent(ref); exchange.getEventListener().onResponseContent(ref);

View File

@ -45,4 +45,15 @@ public interface AsyncEndPoint extends EndPoint
* it becomes writable. * it becomes writable.
*/ */
public void scheduleWrite(); public void scheduleWrite();
/* ------------------------------------------------------------ */
/** Schedule a call to the idle timeout
*/
public void scheduleIdle();
/* ------------------------------------------------------------ */
/** Cancel a call to the idle timeout
*/
public void cancelIdle();
} }

View File

@ -336,6 +336,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements Runnable,
finally finally
{ {
_writeBlocked=false; _writeBlocked=false;
if (_idleTask.isScheduled())
scheduleIdle();
} }
} }
return true; return true;

View File

@ -981,6 +981,8 @@ public class HttpConnection implements Connection
@Override @Override
public void headerComplete() throws IOException public void headerComplete() throws IOException
{ {
if (_endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleIdle();
_requests++; _requests++;
_generator.setVersion(_version); _generator.setVersion(_version);
switch (_version) switch (_version)
@ -1032,6 +1034,8 @@ public class HttpConnection implements Connection
@Override @Override
public void content(Buffer ref) throws IOException public void content(Buffer ref) throws IOException
{ {
if (_endp instanceof AsyncEndPoint)
((AsyncEndPoint)_endp).scheduleIdle();
if (_delayedHandling) if (_delayedHandling)
{ {
_delayedHandling=false; _delayedHandling=false;

View File

@ -17,7 +17,7 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
final WebSocketGenerator _generator; final WebSocketGenerator _generator;
final long _timestamp; final long _timestamp;
final WebSocket _websocket; final WebSocket _websocket;
final int _maxIdleTimeMs=300000; final int _maxIdleTimeMs;
public WebSocketConnection(WebSocket websocket, EndPoint endpoint) public WebSocketConnection(WebSocket websocket, EndPoint endpoint)
{ {
@ -26,10 +26,15 @@ public class WebSocketConnection implements Connection, WebSocket.Outbound
public WebSocketConnection(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, long maxIdleTime) public WebSocketConnection(WebSocket websocket, EndPoint endpoint, WebSocketBuffers buffers, long timestamp, long maxIdleTime)
{ {
// TODO - can we use the endpoint idle mechanism?
if (endpoint instanceof AsyncEndPoint)
((AsyncEndPoint)endpoint).cancelIdle();
_endp = endpoint; _endp = endpoint;
_timestamp = timestamp; _timestamp = timestamp;
_websocket = websocket; _websocket = websocket;
_generator = new WebSocketGenerator(buffers, _endp); _generator = new WebSocketGenerator(buffers, _endp);
_maxIdleTimeMs=(int)maxIdleTime;
_parser = new WebSocketParser(buffers, endpoint, new WebSocketParser.EventHandler() _parser = new WebSocketParser(buffers, endpoint, new WebSocketParser.EventHandler()
{ {
public void onFrame(byte frame, String data) public void onFrame(byte frame, String data)