MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / closeConnection

Method closeConnection

Libraries/Http/HttpAsyncClient.cpp:900–930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
911void 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();

Callers

nothing calls this directly

Calls 5

unpipeMethod · 0.80
resetTransportStreamsMethod · 0.80
destroyMethod · 0.45
isValidMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected