summaryrefslogtreecommitdiff
path: root/memcached.h
diff options
context:
space:
mode:
authortom <tom@localhost.com>2021-01-29 12:14:33 +0800
committerdormando <dormando@rydia.net>2021-06-07 22:33:36 -0700
commit2f8add8838553db423acc2d526e89bb917c21814 (patch)
treed4748301c99fbe741f1bc8170f33131f2521ecf0 /memcached.h
parent2a8b96105857dee237889f6a9e02d42352874e02 (diff)
downloadmemcached-2f8add8838553db423acc2d526e89bb917c21814.tar.gz
The total number of UDP datagrams required for the message is calculated incorrectly.
UDP_MAX_PAYLOAD_SIZE actually contains the length of the private UDP header, but resp->tosend only contains the length of the data part. The number of required UDP packets calculated by the original code will be less than the actual need. E.g: 1000000/1400 = 714.2 ceil 715 1000000/1392 = 718.3 ceil 719 Actually 719 datagrams are needed, and 715 is wrong. Signed-off-by: AK Deng <ttttabcd@protonmail.com>
Diffstat (limited to 'memcached.h')
-rw-r--r--memcached.h1
1 files changed, 1 insertions, 0 deletions
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 */