always comsume the date after handle()

even handle() failed.

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
Lai Jiangshan
2016-09-14 10:17:06 +08:00
parent f06259b0b9
commit 21cb97d970
+3 -4
View File
@@ -135,6 +135,7 @@ int hyper_event_read(struct hyper_event *he, int efd)
int offset = he->ops->len_offset;
int end = offset + 4;
int size;
int ret;
fprintf(stdout, "%s\n", __func__);
@@ -198,12 +199,10 @@ int hyper_event_read(struct hyper_event *he, int efd)
}
/* get and consume the whole data */
if (he->ops->handle(he, len) != 0)
return -1;
ret = he->ops->handle(he, len);
buf->get = 0;
return 0;
return ret == 0 ? 0 : -1;
}
int hyper_event_write(struct hyper_event *he, int efd)