MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _addReplyToBuffer

Function _addReplyToBuffer

app/redis-6.2.6/src/networking.c:293–308  ·  view source on GitHub ↗

Attempts to add the reply to the static buffer in the client struct. * Returns C_ERR if the buffer is full, or the reply list is not empty, * in which case the reply must be added to the reply list. */

Source from the content-addressed store, hash-verified

291 * Returns C_ERR if the buffer is full, or the reply list is not empty,
292 * in which case the reply must be added to the reply list. */
293int _addReplyToBuffer(client *c, const char *s, size_t len) {
294 size_t available = sizeof(c->buf)-c->bufpos;
295
296 if (c->flags & CLIENT_CLOSE_AFTER_REPLY) return C_OK;
297
298 /* If there already are entries in the reply list, we cannot
299 * add anything more to the static buffer. */
300 if (listLength(c->reply) > 0) return C_ERR;
301
302 /* Check that the buffer has enough space available for this string. */
303 if (len > available) return C_ERR;
304
305 memcpy(c->buf+c->bufpos,s,len);
306 c->bufpos+=len;
307 return C_OK;
308}
309
310/* Adds the reply to the reply linked list.
311 * Note: some edits to this function need to be relayed to AddReplyFromClient. */

Callers 3

addReplyFunction · 0.85
addReplySdsFunction · 0.85
addReplyProtoFunction · 0.85

Calls 1

memcpyFunction · 0.50

Tested by

no test coverage detected