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

Method waitForStopToFinish

Libraries/Http/HttpAsyncServer.cpp:86–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84{
85 SC_TRY_MSG(state == State::Stopping, "HttpAsyncServer::waitForStopToFinish requires stopping state");
86 while (connections.getNumActiveConnections() > 0)
87 {
88 SC_TRY(eventLoop->runNoWait());
89 }
90 while (not asyncServerAccept.isFree())
91 {
92 SC_TRY(eventLoop->runNoWait());
93 }
94 bool checkAgainAllClients;
95 do
96 {
97 checkAgainAllClients = false;
98 for (size_t idx = 0; idx < connections.getNumTotalConnections(); ++idx)
99 {
100 HttpConnection& client = static_cast<HttpConnection&>(connections.getConnectionAt(idx));
101 while (not client.readableSocketStream.request.isFree() or not client.writableSocketStream.request.isFree())
102 {
103 SC_TRY(eventLoop->runNoWait());
104 checkAgainAllClients = true;
105 }
106 SC_HTTP_ASSERT_RELEASE(client.pipeline.unpipe());
107 }
108 } while (checkAgainAllClients);
109 state = State::Stopped;
110 return Result(true);
111}
112
113struct HttpAsyncServer::EventDataListener
114{
115 HttpAsyncServer& pself;
116 HttpConnection& client;
117

Callers

nothing calls this directly

Calls 4

isFreeMethod · 0.80
unpipeMethod · 0.80
ResultClass · 0.50
runNoWaitMethod · 0.45

Tested by

no test coverage detected