Skip to content
This repository was archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21 from cloudflare/master
Browse files Browse the repository at this point in the history
Twemcache starts spinning with 100% CPU because of bad UDP packages
  • Loading branch information
Yao Yue committed Jan 31, 2013
2 parents 23b6c0e + 40fcc8a commit 1d0d8a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/mc_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1d0d8a5

Please sign in to comment.