diff options
author | Greg Wilkins | 2014-11-27 07:02:03 +0000 |
---|---|---|
committer | Greg Wilkins | 2014-11-27 07:23:21 +0000 |
commit | 981e27b38361987c8af5673dfcb9dd6bf38c6cd1 (patch) | |
tree | d9d6eb505aa8b88dfee0e1a8c18cb9b702a56f7a | |
parent | a129b0bcd186f6cdbc5258e3ed82d475ad899a44 (diff) | |
download | org.eclipse.jetty.project-981e27b38361987c8af5673dfcb9dd6bf38c6cd1.tar.gz org.eclipse.jetty.project-981e27b38361987c8af5673dfcb9dd6bf38c6cd1.tar.xz org.eclipse.jetty.project-981e27b38361987c8af5673dfcb9dd6bf38c6cd1.zip |
452246 Fixed SSL hang on last chunk
Back ported refinements from 9.3 to handle empty arrays
-rw-r--r-- | jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java index b42e08450c..904f2ebdd0 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/WriteFlusher.java @@ -46,7 +46,6 @@ abstract public class WriteFlusher { private static final Logger LOG = Log.getLogger(WriteFlusher.class); private static final boolean DEBUG = LOG.isDebugEnabled(); // Easy for the compiler to remove the code if DEBUG==false - private static final ByteBuffer[] NO_BUFFERS = new ByteBuffer[0]; private static final ByteBuffer[] EMPTY_BUFFERS = new ByteBuffer[]{BufferUtil.EMPTY_BUFFER}; private static final EnumMap<StateType, Set<StateType>> __stateTransitions = new EnumMap<>(StateType.class); private static final State __IDLE = new IdleState(); @@ -405,11 +404,13 @@ abstract public class WriteFlusher boolean progress=true; while(progress && buffers!=null) { - int before=buffers[0].remaining(); + int before=buffers.length==0?0:buffers[0].remaining(); + boolean flushed=_endPoint.flush(buffers); + int r=buffers.length==0?0:buffers[0].remaining(); - if (_endPoint.flush(buffers)) + if (flushed) return null; - int r=buffers[0].remaining(); + progress=before!=r; int not_empty=0; @@ -421,6 +422,7 @@ abstract public class WriteFlusher not_empty=0; break; } + progress=true; r=buffers[not_empty].remaining(); } |