Lines Matching refs:resp
826 mc_resp *resp = c->resp_head; in conn_release_items() local
828 while (resp) { in conn_release_items()
832 if (resp->free) { in conn_release_items()
838 c->resp = NULL; in conn_release_items()
841 resp = resp_finish(c, resp); in conn_release_items()
980 MEMCACHED_PROCESS_COMMAND_END(c->sfd, c->resp->wbuf, c->resp->wbytes); in conn_set_state()
989 void resp_reset(mc_resp *resp) { in resp_reset() argument
990 if (resp->item) { in resp_reset()
991 item_remove(resp->item); in resp_reset()
992 resp->item = NULL; in resp_reset()
994 if (resp->write_and_free) { in resp_reset()
996 if (resp->proxy_res) { in resp_reset()
997 LIBEVENT_THREAD *t = resp->bundle->thread; in resp_reset()
999 t->proxy_buffer_memory_used -= resp->wbytes; in resp_reset()
1003 free(resp->write_and_free); in resp_reset()
1004 resp->write_and_free = NULL; in resp_reset()
1006 resp->wbytes = 0; in resp_reset()
1007 resp->tosend = 0; in resp_reset()
1008 resp->iovcnt = 0; in resp_reset()
1009 resp->chunked_data_iov = 0; in resp_reset()
1010 resp->chunked_total = 0; in resp_reset()
1011 resp->skip = false; in resp_reset()
1014 void resp_add_iov(mc_resp *resp, const void *buf, int len) { in resp_add_iov() argument
1015 assert(resp->iovcnt < MC_RESP_IOVCOUNT); in resp_add_iov()
1016 int x = resp->iovcnt; in resp_add_iov()
1017 resp->iov[x].iov_base = (void *)buf; in resp_add_iov()
1018 resp->iov[x].iov_len = len; in resp_add_iov()
1019 resp->iovcnt++; in resp_add_iov()
1020 resp->tosend += len; in resp_add_iov()
1026 void resp_add_chunked_iov(mc_resp *resp, const void *buf, int len) { in resp_add_chunked_iov() argument
1027 resp->chunked_data_iov = resp->iovcnt; in resp_add_chunked_iov()
1028 resp->chunked_total = len; in resp_add_chunked_iov()
1029 resp_add_iov(resp, buf, len); in resp_add_chunked_iov()
1039 mc_resp *resp = NULL; in resp_allocate() local
1047 resp = &b->r[x]; in resp_allocate()
1053 if (resp != NULL) { in resp_allocate()
1055 memset(resp, 0, sizeof(*resp)); in resp_allocate()
1056 resp->free = false; // redundant, for clarity. in resp_allocate()
1057 resp->bundle = b; in resp_allocate()
1071 if (resp == NULL) { in resp_allocate()
1087 resp = &b->r[0]; in resp_allocate()
1088 memset(resp, 0, sizeof(*resp)); in resp_allocate()
1089 resp->free = false; // redundant. for clarity. in resp_allocate()
1090 resp->bundle = b; in resp_allocate()
1096 return resp; in resp_allocate()
1099 void resp_free(LIBEVENT_THREAD *th, mc_resp *resp) { in resp_free() argument
1100 mc_resp_bundle *b = resp->bundle; in resp_free()
1102 resp->free = true; in resp_free()
1148 mc_resp *resp = resp_allocate(c); in resp_start() local
1149 if (!resp) { in resp_start()
1162 c->resp_head = resp; in resp_start()
1164 if (!c->resp) { in resp_start()
1165 c->resp = resp; in resp_start()
1167 c->resp->next = resp; in resp_start()
1168 c->resp = resp; in resp_start()
1172 c->resp->request_id = c->request_id; in resp_start()
1173 c->resp->request_addr = c->request_addr; in resp_start()
1174 c->resp->request_addr_size = c->request_addr_size; in resp_start()
1180 mc_resp *resp = resp_allocate(c); in resp_start_unlinked() local
1181 if (!resp) { in resp_start_unlinked()
1195 c->resp->request_id = c->request_id; in resp_start_unlinked()
1196 c->resp->request_addr = c->request_addr; in resp_start_unlinked()
1197 c->resp->request_addr_size = c->request_addr_size; in resp_start_unlinked()
1200 return resp; in resp_start_unlinked()
1204 mc_resp* resp_finish(conn *c, mc_resp *resp) { in resp_finish() argument
1205 mc_resp *next = resp->next; in resp_finish()
1206 if (resp->item) { in resp_finish()
1208 item_remove(resp->item); in resp_finish()
1209 resp->item = NULL; in resp_finish()
1211 if (resp->write_and_free) { in resp_finish()
1213 if (resp->proxy_res) { in resp_finish()
1214 LIBEVENT_THREAD *t = resp->bundle->thread; in resp_finish()
1216 t->proxy_buffer_memory_used -= resp->wbytes; in resp_finish()
1220 free(resp->write_and_free); in resp_finish()
1222 if (resp->io_pending) { in resp_finish()
1223 io_pending_t *io = resp->io_pending; in resp_finish()
1228 resp->io_pending = NULL; in resp_finish()
1230 if (c->resp_head == resp) { in resp_finish()
1233 if (c->resp == resp) { in resp_finish()
1234 c->resp = NULL; in resp_finish()
1236 resp_free(c->thread, resp); in resp_finish()
1248 mc_resp *resp = c->resp; in out_string() local
1255 resp_reset(resp); in out_string()
1260 resp->skip = true; in out_string()
1279 memcpy(resp->wbuf, str, len); in out_string()
1280 memcpy(resp->wbuf + len, "\r\n", 2); in out_string()
1281 resp_add_iov(resp, resp->wbuf, len + 2); in out_string()
1742 mc_resp *resp = c->resp; in write_and_free() local
1743 resp->write_and_free = buf; in write_and_free()
1744 resp_add_iov(resp, buf, bytes); in write_and_free()
2589 mc_resp *resp = c->resp_head; local
2590 while (resp && iovused + resp->iovcnt < IOV_MAX-1) {
2591 if (resp->skip) {
2594 resp = resp->next;
2597 if (resp->chunked_data_iov) {
2601 … item_chunk *ch = (item_chunk *)ITEM_schunk((item *)resp->iov[resp->chunked_data_iov].iov_base);
2603 for (x = 0; x < resp->iovcnt; x++) {
2605 if (x == resp->chunked_data_iov) {
2606 int done = resp->chunked_total - resp->iov[x].iov_len;
2608 int todo = resp->iov[x].iov_len;
2632 iovs[iovused].iov_base = resp->iov[x].iov_base;
2633 iovs[iovused].iov_len = resp->iov[x].iov_len;
2640 memcpy(&iovs[iovused], resp->iov, sizeof(struct iovec)*resp->iovcnt);
2641 iovused += resp->iovcnt;
2645 resp = resp->next;
2660 mc_resp *resp = c->resp_head; local
2661 while (resp) {
2663 if (resp->skip) {
2664 resp = resp_finish(c, resp);
2669 if (res >= resp->tosend) {
2670 res -= resp->tosend;
2671 resp = resp_finish(c, resp);
2676 for (x = 0; x < resp->iovcnt; x++) {
2677 struct iovec *iov = &resp->iov[x];
2679 resp->tosend -= iov->iov_len;
2687 if (!resp->chunked_data_iov || x != resp->chunked_data_iov) {
2691 resp->tosend -= res;
2698 if (resp->tosend == 0) {
2699 resp = resp_finish(c, resp);
2771 static void build_udp_header(unsigned char *hdr, mc_resp *resp) { argument
2775 if (!resp->udp_total) {
2777 total = resp->tosend / UDP_DATA_SIZE;
2778 if (resp->tosend % UDP_DATA_SIZE)
2785 resp->udp_total = total;
2790 *hdr++ = resp->request_id / 256;
2791 *hdr++ = resp->request_id % 256;
2792 *hdr++ = resp->udp_sequence / 256;
2793 *hdr++ = resp->udp_sequence % 256;
2794 *hdr++ = resp->udp_total / 256;
2795 *hdr++ = resp->udp_total % 256;
2798 resp->udp_sequence++;
2817 mc_resp *resp; local
2823 resp = c->resp_head;
2825 if (!resp) {
2829 if (resp->skip) {
2830 resp = resp_finish(c, resp);
2839 msg.msg_name = &resp->request_addr;
2840 msg.msg_namelen = resp->request_addr_size;
2845 build_udp_header(udp_hdr, resp);