diff options
-rw-r--r-- | memcached.c | 4 | ||||
-rw-r--r-- | memcached.h | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/memcached.c b/memcached.c index f41a89d..54369cd 100644 --- a/memcached.c +++ b/memcached.c @@ -2635,8 +2635,8 @@ static void build_udp_header(unsigned char *hdr, mc_resp *resp) { // header, so "tosend" must be static. if (!resp->udp_total) { uint32_t total; - total = resp->tosend / UDP_MAX_PAYLOAD_SIZE; - if (resp->tosend % UDP_MAX_PAYLOAD_SIZE) + total = resp->tosend / UDP_DATA_SIZE; + if (resp->tosend % UDP_DATA_SIZE) total++; // The spec doesn't really say what we should do here. It's _probably_ // better to bail out? diff --git a/memcached.h b/memcached.h index e569ad5..1202fa0 100644 --- a/memcached.h +++ b/memcached.h @@ -71,6 +71,7 @@ #define UDP_READ_BUFFER_SIZE 65536 #define UDP_MAX_PAYLOAD_SIZE 1400 #define UDP_HEADER_SIZE 8 +#define UDP_DATA_SIZE 1392 // UDP_MAX_PAYLOAD_SIZE - UDP_HEADER_SIZE #define MAX_SENDBUF_SIZE (256 * 1024 * 1024) /* Binary protocol stuff */ |