size_t len; 3 4 assert(c != NULL); 5 6 if (c->noreply) { 7 if (settings.verbose > 1) 8 fprintf(stderr, ">%d NOREPLY %s\n", c->sfd, str); 9 c->noreply = false; 10 conn_set_state(c, conn_new_cmd); 11 return; 12 } 13 14 if (settings.verbose > 1) 15 fprintf(stderr, ">%d %s\n", c->sfd, str); 16 17 /* Nuke a partial output... */ 18 c->msgcurr = 0; 19 c->msgused = 0; 20 c->iovused = 0; 21 add_msghdr(c); 22 23 len = strlen(str); 24 if ((len + 2) > c->wsize) { 25 /* ought to be always enough. just fail for simplicity */ 26 str = "SERVER_ERROR output line too long"; 27 len = strlen(str); 28 } 29 30 memcpy(c->wbuf, str, len); 31 memcpy(c->wbuf + len, "\r\n", 2); 5 https://github.com/memcached/memcached/blob/master/memcached.c