MCPcopy Create free account
hub / github.com/LUX-Core/lux / ChunkEnd

Method ChunkEnd

src/httpserver.cpp:649–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649void HTTPRequest::ChunkEnd() {
650 assert(startedChunkTransfer && !replySent);
651
652 HTTPEvent* ev = new HTTPEvent(eventBase, true, NULL,
653 std::bind(evhttp_send_reply_end, req));
654
655 ev->trigger(0);
656
657 // If HTTPRequest is destroyed before connection is closed, evhttp seems to get messed up.
658 // We wait here for connection close before returning back to the handler, where HTTPRequest will be reclaimed.
659 waitClientClose();
660
661 replySent = true;
662 // `WriteReply` sets req to 0 to prevent req from being freed. But this is not enough in the case of long-polling.
663 // Something is still freed to early.
664 // req = 0;
665}
666
667void HTTPRequest::Chunk(const std::string& chunk) {
668 assert(!replySent);

Callers 3

JSONErrorReplyFunction · 0.80
PollCancelMethod · 0.80
PollReplyMethod · 0.80

Calls 1

triggerMethod · 0.80

Tested by

no test coverage detected