Handle faults with meas_lat

This commit is contained in:
Quentin Dufour 2019-03-05 16:21:25 +01:00
parent 4add03efa2
commit c322c9acff
2 changed files with 10 additions and 3 deletions

View file

@ -173,10 +173,13 @@ void evt_core_loop(struct evt_core_ctx* ctx) {
fdinfo = evt_core_get_from_fd(ctx, err_fd);
if (fdinfo != NULL) {
fprintf(stderr, "Clearing fd=%d on cat=%s\n", err_fd, fdinfo->cat->name);
if (fdinfo->cat->err_cb != NULL) {
while (fdinfo->cat->err_cb(ctx, fdinfo) == 0);
if (fdinfo->cat->err_cb(ctx, fdinfo) == 1) {
fprintf(stderr, "fd=%d on cat=%s is handled by app\n", err_fd, fdinfo->cat->name);
continue;
}
}
fprintf(stderr, "Clearing fd=%d on cat=%s\n", err_fd, fdinfo->cat->name);
evt_core_rm_fd (ctx, err_fd);
} else {
fprintf(stderr, "The file descriptor %d is not registered in a category, this is probably a logic error\n", err_fd);

View file

@ -43,6 +43,10 @@ void free_mesure_conf(void* v) {
free(mc);
}
int on_udp_err(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
return 1;
}
int on_udp(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
ssize_t res;
int secs, nsecs;
@ -121,7 +125,7 @@ void register_categories(struct evt_core_ctx* evts) {
.app_ctx = NULL,
.free_app_ctx = NULL,
.cb = on_udp,
.err_cb = NULL,
.err_cb = on_udp_err,
.name = "udp-read",
.flags = EPOLLIN | EPOLLET,
.socklist = NULL