summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2011-08-07 22:14:10 -0700
committerdormando <dormando@rydia.net>2011-08-10 08:44:52 -0700
commit2928a78562c91d2706b35826eea77f3bf0366035 (patch)
treea25dbb86002ca21823824c45d1d6eb01bb2e5902
parent9af2491b3fd1b417d17a9b2c335d2390a3f92908 (diff)
downloadmemcached-2928a78562c91d2706b35826eea77f3bf0366035.tar.gz
Don't permanently close UDP listeners on error
Also, don't inflate rbytes as we can only ever process one UDP packet at a time. Patch by pi3orama. Fixed by Dormando to use the correct state and actually work. I'm not fully convinced of the rbytes bit. We must ensure that a UDP packet with multiple commands in it has all of its commands processed before we can possibly call recvfrom again.
-rw-r--r--memcached.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/memcached.c b/memcached.c
index c82f5c5..e0bbf89 100644
--- a/memcached.c
+++ b/memcached.c
@@ -493,6 +493,10 @@ static void conn_cleanup(conn *c) {
sasl_dispose(&c->sasl_conn);
c->sasl_conn = NULL;
}
+
+ if (IS_UDP(c->transport)) {
+ conn_set_state(c, conn_read);
+ }
}
/*
@@ -3264,7 +3268,7 @@ static enum try_read_result try_read_udp(conn *c) {
res -= 8;
memmove(c->rbuf, c->rbuf + 8, res);
- c->rbytes += res;
+ c->rbytes = res;
c->rcurr = c->rbuf;
return READ_DATA_RECEIVED;
}