MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / launcherUpdateHttpCb

Function launcherUpdateHttpCb

src/onlineLauncher.cpp:316–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314};
315
316bool launcherUpdateHttpCb(const uint8_t *data, size_t len, void *ctx) {
317 HttpUpdateContext *updateCtx = static_cast<HttpUpdateContext *>(ctx);
318 if (!updateCtx) return false;
319 if (!updateCtx->started) {
320 if (!launcherUpdateBegin(updateCtx->target, updateCtx->expected)) return false;
321 updateCtx->started = true;
322 progressHandler(0, updateCtx->expected);
323 }
324 const size_t remaining =
325 updateCtx->written < updateCtx->expected ? updateCtx->expected - updateCtx->written : 0;
326 const size_t writeLen = len > remaining ? remaining : len;
327 if (writeLen == 0) return true;
328 size_t wrote = launcherUpdateWrite(data, writeLen);
329 if (wrote != writeLen) { return false; }
330 updateCtx->written += wrote;
331 progressHandler(updateCtx->written, updateCtx->expected);
332 return true;
333}
334
335bool launcherRawUpdateHttpCb(const uint8_t *data, size_t len, void *ctx) {
336 RawHttpUpdateContext *updateCtx = static_cast<RawHttpUpdateContext *>(ctx);

Callers

nothing calls this directly

Calls 3

launcherUpdateBeginFunction · 0.85
progressHandlerFunction · 0.85
launcherUpdateWriteFunction · 0.85

Tested by

no test coverage detected