X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fms_conn.h;h=b915888d95d6b9cb420834e55172e719c2745d6b;hb=7fc1ce1d52601c1ba1d8e7ff0035a7243eaf14c3;hp=efdd4aa9a00d4850d06aad067018a3767d24b803;hpb=604540c15315c6ed876082529f639697ba3eceab;p=awesomized%2Flibmemcached diff --git a/clients/ms_conn.h b/clients/ms_conn.h index efdd4aa9..b915888d 100644 --- a/clients/ms_conn.h +++ b/clients/ms_conn.h @@ -17,7 +17,7 @@ #include #include "ms_task.h" -#include "protocol_binary.h" +#include #ifdef __cplusplus extern "C" { @@ -30,8 +30,7 @@ extern "C" { #define UDP_MAX_SEND_PAYLOAD_SIZE 1400 /* mtu size is 1500 */ #define UDP_HEADER_SIZE 8 /* UDP header size */ #define MAX_SENDBUF_SIZE (256 * 1024 * 1024) /* Maximum socket buffer size */ -#define SOCK_WAIT_TIMEOUT 10 /* maximum waiting time of UDP, 10s */ -#define EVENT_TIMEOUT 10 /* maximum waiting time of event,10s */ +#define SOCK_WAIT_TIMEOUT 30 /* maximum waiting time of UDP, 30s */ #define MAX_UDP_PACKET (1 << 16) /* maximum UDP packets, 65536 */ /* Initial size of the sendmsg() scatter/gather array. */ @@ -61,7 +60,7 @@ enum conn_states { conn_read, /* reading in a command line */ conn_write, /* writing out a simple response */ - conn_closing, /* closing this connection */ + conn_closing /* closing this connection */ }; /* returned states of memcached command */ @@ -79,7 +78,7 @@ enum mcd_ret MCD_NOTFOUND, /* server not find the object */ MCD_END, /* end of the response of get command */ MCD_DELETED, /* server delete the object successfully */ - MCD_STAT, /* response of stats command */ + MCD_STAT /* response of stats command */ }; /* used to store the current or previous running command state */ @@ -104,8 +103,7 @@ typedef struct udppkt enum protocol { ascii_prot = 3, /* ASCII protocol */ - ascii_udp_prot, /* ASCII UDP protocol*/ - binary_prot, /* binary protocol */ + binary_prot /* binary protocol */ }; /** @@ -119,7 +117,7 @@ enum protocol */ typedef struct conn { - int conn_idx; /* connection index in the thread */ + uint32_t conn_idx; /* connection index in the thread */ int sfd; /* current tcp sock handler of the connection structure */ int udpsfd; /* current udp sock handler of the connection structure*/ int state; /* state of the connection */ @@ -129,9 +127,9 @@ typedef struct conn bool change_sfd; /* whether change sfd */ int *tcpsfd; /* TCP sock array */ - int total_sfds; /* how many socks in the tcpsfd array */ - int alive_sfds; /* alive socks */ - int cur_idx; /* current sock index in tcpsfd array */ + uint32_t total_sfds; /* how many socks in the tcpsfd array */ + uint32_t alive_sfds; /* alive socks */ + uint32_t cur_idx; /* current sock index in tcpsfd array */ ms_cmdstat_t precmd; /* previous command state */ ms_cmdstat_t currcmd; /* current command state */ @@ -161,8 +159,8 @@ typedef struct conn int msgbytes; /* number of bytes in current msg */ /* data for UDP clients */ - int udp; /* is this is a UDP "connection" */ - int request_id; /* UDP request ID of current operation, if this is a UDP "connection" */ + bool udp; /* is this is a UDP "connection" */ + uint32_t request_id; /* UDP request ID of current operation, if this is a UDP "connection" */ uint8_t *hdrbuf; /* udp packet headers */ int hdrsize; /* number of headers' worth of space is allocated */ struct sockaddr srv_recv_addr; /* Sent the most recent request to which server */ @@ -229,7 +227,7 @@ int ms_mcd_set(ms_conn_t *c, ms_task_item_t *item); /* used to send the get command to server */ -int ms_mcd_get(ms_conn_t *c, ms_task_item_t *item, bool verify); +int ms_mcd_get(ms_conn_t *c, ms_task_item_t *item); /* used to send the multi-get command to server */