From 7a1faf3c08616569706e8a9bbd6aa0fed7fa47d8 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 28 Aug 2012 11:55:01 +0200 Subject: [PATCH] Jetty9 - Start counting for idleness when we register read interest. Otherwise it was possible that the endPoint was created, upon creation it started counting for idleness, after a while read interested was set and the endPoint idle timed out before having the chance to read. --- .../org/eclipse/jetty/io/AbstractEndPoint.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractEndPoint.java index 19992d43e84..04a1c9cf891 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractEndPoint.java @@ -50,8 +50,8 @@ public abstract class AbstractEndPoint implements EndPoint scheduleIdleTimeout(idleLeft > 0 ? idleLeft : getIdleTimeout()); } }; - - + + private volatile long _idleTimeout; private volatile long _idleTimestamp=System.currentTimeMillis(); private volatile Connection _connection; @@ -150,6 +150,7 @@ public abstract class AbstractEndPoint implements EndPoint @Override public void fillInterested(C context, Callback callback) throws IllegalStateException { + notIdle(); _fillInterest.register(context, callback); } @@ -158,16 +159,16 @@ public abstract class AbstractEndPoint implements EndPoint { _writeFlusher.write(context, callback, buffers); } - + protected abstract void onIncompleteFlush(); protected abstract boolean needsFill() throws IOException; - + protected FillInterest getFillInterest() { return _fillInterest; } - + protected WriteFlusher getWriteFlusher() { return _writeFlusher; @@ -212,16 +213,16 @@ public abstract class AbstractEndPoint implements EndPoint } } } - + return idleLeft>=0?idleLeft:0; } return -1; } - + @Override public String toString() { - + return String.format("%s@%x{%s%s,o=%b,is=%b,os=%b,fi=%s,wf=%s}{%s}", getClass().getSimpleName(), hashCode(),