Mercurial Hosting > luan
changeset 1035:898774c2cd87
remove HttpGenerator.returnBuffers()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 03 Nov 2016 21:09:57 -0600 |
parents | 563458c4dc93 |
children | b87f97f6418a |
files | src/org/eclipse/jetty/http/AbstractGenerator.java src/org/eclipse/jetty/server/AbstractHttpConnection.java src/org/eclipse/jetty/server/AsyncHttpConnection.java src/org/eclipse/jetty/server/BlockingHttpConnection.java |
diffstat | 4 files changed, 45 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
diff -r 563458c4dc93 -r 898774c2cd87 src/org/eclipse/jetty/http/AbstractGenerator.java --- a/src/org/eclipse/jetty/http/AbstractGenerator.java Thu Nov 03 21:02:59 2016 -0600 +++ b/src/org/eclipse/jetty/http/AbstractGenerator.java Thu Nov 03 21:09:57 2016 -0600 @@ -108,19 +108,6 @@ return _endp.isOpen(); } - public final void returnBuffers() - { - if (_buffer!=null && _buffer.length()==0) - { - _buffer=null; - } - - if (_header!=null && _header.length()==0) - { - _header=null; - } - } - public final void resetBuffer() { if(_state>=STATE_FLUSHING)
diff -r 563458c4dc93 -r 898774c2cd87 src/org/eclipse/jetty/server/AbstractHttpConnection.java --- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java Thu Nov 03 21:02:59 2016 -0600 +++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java Thu Nov 03 21:09:57 2016 -0600 @@ -237,7 +237,6 @@ protected void reset() { _requestFields.clear(); - _generator.returnBuffers();// TODO maybe only on unhandle _responseFields.clear(); _uri.clear(); _writer = null;
diff -r 563458c4dc93 -r 898774c2cd87 src/org/eclipse/jetty/server/AsyncHttpConnection.java --- a/src/org/eclipse/jetty/server/AsyncHttpConnection.java Thu Nov 03 21:02:59 2016 -0600 +++ b/src/org/eclipse/jetty/server/AsyncHttpConnection.java Thu Nov 03 21:09:57 2016 -0600 @@ -129,9 +129,6 @@ } finally { - // return buffers - _generator.returnBuffers(); - // Safety net to catch spinning if (some_progress) _total_no_progress = 0;
diff -r 563458c4dc93 -r 898774c2cd87 src/org/eclipse/jetty/server/BlockingHttpConnection.java --- a/src/org/eclipse/jetty/server/BlockingHttpConnection.java Thu Nov 03 21:02:59 2016 -0600 +++ b/src/org/eclipse/jetty/server/BlockingHttpConnection.java Thu Nov 03 21:09:57 2016 -0600 @@ -44,68 +44,61 @@ @Override public void handle() throws IOException { - try + // do while the endpoint is open + // AND the connection has not changed + while (_endp.isOpen()) { - // do while the endpoint is open - // AND the connection has not changed - while (_endp.isOpen()) + try { - try - { - // If we are not ended then parse available - if (!_parser.isComplete() && !_endp.isInputShutdown()) - _parser.parseAvailable(); + // If we are not ended then parse available + if (!_parser.isComplete() && !_endp.isInputShutdown()) + _parser.parseAvailable(); + + // Do we have more generating to do? + // Loop here because some writes may take multiple steps and + // we need to flush them all before potentially blocking in the + // next loop. + if (_generator.isCommitted() && !_generator.isComplete() && !_endp.isOutputShutdown()) + _generator.flushBuffer(); - // Do we have more generating to do? - // Loop here because some writes may take multiple steps and - // we need to flush them all before potentially blocking in the - // next loop. - if (_generator.isCommitted() && !_generator.isComplete() && !_endp.isOutputShutdown()) - _generator.flushBuffer(); + // Flush buffers + _endp.flush(); + } + catch (HttpException e) + { + if (LOG.isDebugEnabled()) + { + LOG.debug("uri="+_uri); + LOG.debug("fields="+_requestFields); + LOG.debug("",e); + } + _generator.sendError(e.getStatus(), e.getReason(), null, true); + initParser(); + _endp.shutdownOutput(); + } + finally + { + // Is this request/response round complete and are fully flushed? + if (_parser.isComplete() && _generator.isComplete()) + { + // Reset the parser/generator + reset(); - // Flush buffers - _endp.flush(); - } - catch (HttpException e) - { - if (LOG.isDebugEnabled()) + // TODO Is this required? + if (!_generator.isPersistent() && !_endp.isOutputShutdown()) { - LOG.debug("uri="+_uri); - LOG.debug("fields="+_requestFields); - LOG.debug("",e); + LOG.warn("Safety net oshut!!! Please open a bugzilla"); + _endp.shutdownOutput(); } - _generator.sendError(e.getStatus(), e.getReason(), null, true); - initParser(); - _endp.shutdownOutput(); } - finally + + // If we don't have a committed response and we are not suspended + if (_endp.isInputShutdown() && _generator.isIdle()) { - // Is this request/response round complete and are fully flushed? - if (_parser.isComplete() && _generator.isComplete()) - { - // Reset the parser/generator - reset(); - - // TODO Is this required? - if (!_generator.isPersistent() && !_endp.isOutputShutdown()) - { - LOG.warn("Safety net oshut!!! Please open a bugzilla"); - _endp.shutdownOutput(); - } - } - - // If we don't have a committed response and we are not suspended - if (_endp.isInputShutdown() && _generator.isIdle()) - { - // then no more can happen, so close. - _endp.close(); - } + // then no more can happen, so close. + _endp.close(); } } } - finally - { - _generator.returnBuffers(); - } } }