summaryrefslogtreecommitdiff
path: root/proxy_network.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2022-07-18 22:54:48 -0700
committerdormando <dormando@rydia.net>2022-07-24 23:02:50 -0700
commit7607b79e1fd642a618b4e017c438793db673a682 (patch)
treef32204f336bc290d3a145527f9b9e6892cc7c3db /proxy_network.c
parenta53d760f2b011730f0d15b878e12e2e80bf87ba1 (diff)
downloadmemcached-7607b79e1fd642a618b4e017c438793db673a682.tar.gz
proxy: fix potential corruption on partial write
If a command was partially sent we were not decrementing the byte sum cache. This would lead to listening on the wrong event and potentially causing corruption. It might be better to remove the cache to avoid mistakes like this and for loop it each time.
Diffstat (limited to 'proxy_network.c')
-rw-r--r--proxy_network.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/proxy_network.c b/proxy_network.c
index a8d8f60..1ec186d 100644
--- a/proxy_network.c
+++ b/proxy_network.c
@@ -885,6 +885,7 @@ static int _flush_pending_write(mcp_backend_t *be) {
// short circuit for common case.
sent -= io->iovbytes;
} else {
+ io->iovbytes -= sent;
for (int x = 0; x < io->iovcnt; x++) {
struct iovec *iov = &io->iov[x];
if (sent >= iov->iov_len) {