diff --git a/src/mc_connection.c b/src/mc_connection.c index 136b852..6b8d609 100644 --- a/src/mc_connection.c +++ b/src/mc_connection.c @@ -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 diff --git a/src/mc_core.c b/src/mc_core.c index 9d6f8ea..a5d89ad 100644 --- a/src/mc_core.c +++ b/src/mc_core.c @@ -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;