Let's say you are currently consuming a HttpClientResponse as a ReadStream, transferring the incoming data to a HttpServerResponse using a Pump to have flow control.
Assume an error occurs while writing to the HttpServerResponse. It could be that it raised an exception (invoking its registered exceptionHandler) or the connection was closed prematurely (invoking its registered closeHandler). At this point, we can stop the pump, which sets a null handler in the HttpClientResponse. We can also pause the response, making sure it stops producing data. But how can we let the server knows (server from which we receive the data through the HttpClientResponse), that it should stop producing data since it won't be consumed anyways. In a way, we want to abort the "request/response" exchange without necessarily closing the underlying http connection since we are taking advantage of keep-alive and therefore the connection might be reused for other requests.
Perhaps in this case, which we could consider a edge case, it is acceptable to close the connection. However, I'm not convinced that calling response.netSocket().close() is safe as it might not release the connection from the connection pool. Is it the actual recommended way to handle this situation? Is there a better alternative?
Thanks for advising.