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

Method onConnected

Libraries/Http/HttpAsyncClient.cpp:269–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267{
268 if (not result.isValid())
269 {
270 fail(result.isValid());
271 return;
272 }
273
274 Result readInit = connection->readableSocketStream.init(connection->buffersPool, *eventLoop, connection->socket);
275 if (not readInit)
276 {
277 fail(readInit);
278 return;
279 }
280 Result writeInit = connection->writableSocketStream.init(connection->buffersPool, *eventLoop, connection->socket);
281 if (not writeInit)
282 {
283 fail(writeInit);
284 return;
285 }
286 connection->resetTransportStreams();
287
288 if (transportSetup.isValid())
289 {
290 HttpAsyncClientTransportSetup setup;
291 setup.connection = connection;
292 setup.eventLoop = eventLoop;
293 setup.url = &currentURL;
294 setup.complete = {[this](Result setupResult) { completeTransportSetup(setupResult); }};
295
296 Result nativeSocket =
297 connection->socket.get(setup.nativeSocket, Result::Error("HttpAsyncClient invalid socket"));
298 if (not nativeSocket)
299 {
300 fail(nativeSocket);
301 return;
302 }
303
304 Result setupResult = transportSetup(setup);
305 if (not setupResult)
306 {
307 fail(setupResult);
308 }
309 return;
310 }
311

Callers

nothing calls this directly

Calls 4

resetTransportStreamsMethod · 0.80
ResultClass · 0.50
isValidMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected