/* add function for send to comet */ void notify_comet(char *key, char *str) { int nudge = atoi(key); if (requests[nudge] != NULL) { evbuffer_add_printf(bufs[nudge], "Oops, from memcache: %s!\r\n", str); evhttp_send_reply_chunk(requests[nudge], bufs[nudge]); } }
/* * we get here after reading the value in set/add/replace commands. The command * has been stored in c->item_comm, and the item is ready in c->item. * 这个函数完全修改了 */ void complete_nread(conn * c) { item *it = &(c->item);
int comm = c->item_comm;
int ret;
stats.set_cmds++;
while (1) { if (strncmp(ITEM_data(it) + it->nbytes - 2, "\r\n", 2) != 0) { out_string(c, "CLIENT_ERROR bad data chunk"); break; } out_string(c, "STORED");
// send to comet server notify_comet(ITEM_key(it), ITEM_data(it)); break; }