| 898 | currentRequest = nullptr; |
| 899 | |
| 900 | if (shouldFinishBodyStream) |
| 901 | { |
| 902 | response.finishBodyStream(); |
| 903 | } |
| 904 | |
| 905 | if (not keepAlive and state == State::Idle and currentRequest == nullptr) |
| 906 | { |
| 907 | closeConnection(); |
| 908 | } |
| 909 | } |
| 910 | |
| 911 | void HttpAsyncClient::closeConnection() |
| 912 | { |
| 913 | if (connection == nullptr) |
| 914 | { |
| 915 | return; |
| 916 | } |
| 917 | (void)connection->getReadableTransportStream() |
| 918 | .eventData.removeListener<HttpAsyncClient, &HttpAsyncClient::onResponseData>(*this); |
| 919 | (void)connection->getReadableTransportStream() |
| 920 | .eventData.removeListener<HttpAsyncClient, &HttpAsyncClient::onResponseBodyData>(*this); |
| 921 | (void)connection->getReadableTransportStream() |
| 922 | .eventError.removeListener<HttpAsyncClient, &HttpAsyncClient::onReadableError>(*this); |
| 923 | (void)connection->getWritableTransportStream() |
| 924 | .eventError.removeListener<HttpAsyncClient, &HttpAsyncClient::onWritableError>(*this); |
| 925 | (void)connection->getReadableTransportStream() |
| 926 | .eventEnd.removeListener<HttpAsyncClient, &HttpAsyncClient::onReadableEnd>(*this); |
| 927 | (void)connection->pipeline.eventError.removeListener<HttpAsyncClient, &HttpAsyncClient::onPipelineError>(*this); |
| 928 | (void)connection->pipeline.unpipe(); |
| 929 | if (transportClose.isValid()) |
| 930 | { |
| 931 | transportClose(); |
| 932 | } |
| 933 | connection->readableSocketStream.destroy(); |
nothing calls this directly
no test coverage detected