From: Pavel Rochnyack Date: Sun, 10 Dec 2017 20:24:33 +0000 (+0700) Subject: memcached: Check for closed connection to avoid deadloop X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=72b9b3e5e038f7e06c76d9b7719aa8f476d0811b;p=collectd.git memcached: Check for closed connection to avoid deadloop Check for 'recv(...) == 0' condition was missing. --- diff --git a/src/memcached.c b/src/memcached.c index 1cd5a301..d2827a48 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -291,6 +291,12 @@ static int memcached_query_daemon(char *buffer, size_t buffer_size, close(st->fd); st->fd = -1; return -1; + } else if (status == 0) { + ERROR("memcached plugin: Instance \"%s\": Connection closed by peer", + st->name); + close(st->fd); + st->fd = -1; + return -1; } buffer_fill += (size_t)status;