jetty-9 removed horrid hack to make onClose events work

This commit is contained in:
Greg Wilkins 2012-05-25 09:41:23 +02:00
parent 0789690cea
commit c274cb6413
2 changed files with 9 additions and 10 deletions

View File

@ -173,7 +173,7 @@ public class HttpParser
/* ------------------------------------------------------------ */
public boolean isComplete()
{
return isState(State.END);
return isState(State.END)||isState(State.CLOSED);
}
/* ------------------------------------------------------------------------------- */
@ -1084,7 +1084,7 @@ public class HttpParser
}
/* ------------------------------------------------------------------------------- */
public boolean inputShutdown() throws IOException
public void inputShutdown()
{
_persistent=false;
@ -1108,10 +1108,6 @@ public class HttpParser
LOG.debug("shutdownInput {}",this);
if (!isComplete() && !isStart())
throw new EofException();
return true;
}
/* ------------------------------------------------------------------------------- */

View File

@ -236,7 +236,14 @@ public class HttpConnection extends AbstractAsyncConnection
if (filled==0)
scheduleOnReadable();
else
{
_parser.inputShutdown();
// We were only filling if fully consumed, so if we have
// read -1 then we have nothing to parse and thus nothing that
// will generate a response. If we had a suspended request pending
// a response or a request waiting in the buffer, we would not be here.
getEndPoint().shutdownOutput();
}
// buffer must be empty and the channel must be idle, so we can release.
releaseRequestBuffer();
@ -283,10 +290,6 @@ public class HttpConnection extends AbstractAsyncConnection
}
finally
{
// TODO this is wrong wrong wrong wrong!
if (_parser.isComplete()&&!_parser.isPersistent()&&getEndPoint().isOpen())
getEndPoint().shutdownOutput();
setCurrentConnection(null);
}
}