mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-09-04 12:41:53 +00:00
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:
+2
-4
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user