Fixes #12916 - Bad example in JavaDoc of InputStreamResponseListener.#12927
Conversation
Made InputStreamResponseListener implement AutoCloseable. Updated tests, javadocs and documentation. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
| @Override | ||
| public void close() throws IOException | ||
| { | ||
| stream.updateAndGet(input -> input == null ? InputStream.nullInputStream() : input).close(); |
There was a problem hiding this comment.
This doesn't really change anything if the stream was never created.
I expected this to release all chunks that have been received already, and probably abort an already demanded but not yet received chunk, or maybe the whole response (does that actually happen in Input.close?).
So when the InputStream hasn't been created yet, the behavior should be similar to getInputStream().close(). You could achieve this by changing this slightly to create a real Input instead of a nullInputStream, or you could try avoiding to create a stream and invoking the corresponding logic directly.
Fixed InputStreamResponseListener.close() to properly flip the `closed` field. Made InputStreamResponseListener.close() and InputStreamResponseListener.Input.close() call the same code. Fixed buffer leaking by releasing the network buffer upon connection close in HTTP and FCGI. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Fixed InputStreamResponseListener.close() to properly flip the `closed` field. Made InputStreamResponseListener.close() and InputStreamResponseListener.Input.close() call the same code. Fixed buffer leaking by releasing the network buffer upon connection close in HTTP and FCGI. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
|
See also #12931. |
|
@mperktold can you please review #12931? |
|
@sbordet looks good now! I see that you also improved releasing the buffers, that's great! 👍 |
* Fixed InputStreamResponseListener.close() to properly flip the `closed` field. * Made InputStreamResponseListener.close() and InputStreamResponseListener.Input.close() call the same code. * Fixed buffer leaking by releasing the network buffer upon connection close in HTTP and FCGI. * Fixed race in HTTP2Stream. A DATA frame could have been enqueued even if the stream was reset or failed, and stay there without being released. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Made InputStreamResponseListener implement AutoCloseable. Updated tests, javadocs and documentation.