From 8d979408b787032f4ba9edbdb5a930dc2e063980 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 21 Feb 2014 12:31:31 +1100 Subject: [PATCH] 428660 Delay closing async HttpOutput until after UNREADY->READY --- .../org/eclipse/jetty/server/HttpOutput.java | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java index 99a94235d12..711391d83ee 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java @@ -163,7 +163,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable } } - /* Called to indicated that the output is already closed and the state needs to be updated to match */ + /* Called to indicated that the output is already closed (write with last==true performed) and the state needs to be updated to match */ void closed() { loop: while(true) @@ -894,19 +894,25 @@ public class HttpOutput extends ServletOutputStream implements Runnable // all content written, but if we have not yet signal completion, we // need to do so - if (_complete) + if (_complete && !_completed) { - if (!_completed) - { - _completed=true; - write(BufferUtil.EMPTY_BUFFER, _complete, this); - return Action.SCHEDULED; - } - closed(); + _completed=true; + write(BufferUtil.EMPTY_BUFFER, _complete, this); + return Action.SCHEDULED; } return Action.SUCCEEDED; } + + @Override + protected void completed() + { + super.completed(); + if (_complete) + closed(); + } + + }