direct set the buf->get to zero after consume

the handle() had consumed all the read data,
and we don't need to move the leftover data.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-09-14 10:12:41 +08:00
parent 70dd9f1447
commit f06259b0b9
+2 -4
View File
@@ -197,13 +197,11 @@ int hyper_event_read(struct hyper_event *he, int efd)
return 0;
}
/* get the whole data */
/* get and consume the whole data */
if (he->ops->handle(he, len) != 0)
return -1;
/* len: length of the already get new data */
buf->get -= len;
memmove(buf->data, buf->data + len, buf->get);
buf->get = 0;
return 0;
}