MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / _clientAsyncReplyBufferReserve

Function _clientAsyncReplyBufferReserve

src/networking.cpp:339–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337 * -------------------------------------------------------------------------- */
338
339void _clientAsyncReplyBufferReserve(client *c, size_t len) {
340 if (c->replyAsync != nullptr)
341 return;
342 size_t newsize = std::max(len, (size_t)PROTO_ASYNC_REPLY_CHUNK_BYTES);
343 clientReplyBlock *replyNew = (clientReplyBlock*)zmalloc(sizeof(clientReplyBlock) + newsize);
344 replyNew->size = zmalloc_usable_size(replyNew) - sizeof(clientReplyBlock);
345 replyNew->used = 0;
346 c->replyAsync = replyNew;
347}
348
349/* Attempts to add the reply to the static buffer in the client struct.
350 * Returns C_ERR if the buffer is full, or the reply list is not empty,

Callers

nothing calls this directly

Calls 2

zmallocFunction · 0.85
zmalloc_usable_sizeFunction · 0.85

Tested by

no test coverage detected