Permalink
Browse files

Merge pull request #21 from cloudflare/master

Twemcache starts spinning with 100% CPU because of bad UDP packages
  • Loading branch information...
2 parents 23b6c0e + 40fcc8a commit 1d0d8a58df7305406beb8ba68068cb49d63cf980 @thinkingfish thinkingfish committed Jan 31, 2013
Showing with 5 additions and 1 deletion.
  1. +4 −0 src/mc_connection.c
  2. +1 −1 src/mc_core.c
View
@@ -312,6 +312,10 @@ conn_cleanup(struct conn *c)
if (c->write_and_free != NULL) {
mc_free(c->write_and_free);
}
+
+ if (c->udp) {
+ conn_set_state(c, CONN_READ);
+ }
}
void
View
@@ -147,7 +147,7 @@ core_read_udp(struct 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;

0 comments on commit 1d0d8a5

Please sign in to comment.