MCPcopy Create free account
hub / github.com/3rdparty/libprocess / disconnect

Method disconnect

src/http.cpp:1187–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1185 }
1186
1187 Future<Nothing> disconnect(const Option<string>& message = None())
1188 {
1189 Try<Nothing, SocketError> shutdown = socket.shutdown(
1190 network::Socket::Shutdown::READ_WRITE);
1191
1192 // If a response is still streaming, we send EOF to
1193 // the decoder in order to fail the pipe reader.
1194 if (decoder.writingBody()) {
1195 decoder.decode("", 0);
1196 }
1197
1198 // Fail any remaining pipelined responses.
1199 while (!pipeline.empty()) {
1200 std::get<1>(pipeline.front()).fail(
1201 message.isSome() ? message.get() : "Disconnected");
1202 pipeline.pop();
1203 }
1204
1205 disconnection.set(Nothing());
1206
1207 return shutdown.isSome() ? Future<Nothing>(Nothing())
1208 : Failure(shutdown.error().message);
1209 }
1210
1211 Future<Nothing> disconnected()
1212 {

Callers

nothing calls this directly

Calls 8

FailureClass · 0.85
writingBodyMethod · 0.80
shutdownMethod · 0.45
decodeMethod · 0.45
emptyMethod · 0.45
failMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected