diff --git a/src/algo_rr.c b/src/algo_rr.c index b8b7469..792c820 100644 --- a/src/algo_rr.c +++ b/src/algo_rr.c @@ -403,11 +403,20 @@ co_error: } int rr_on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { + uint64_t ctr; + ssize_t tmr_rd; + tmr_rd = read(fdinfo->fd, &ctr, sizeof(ctr)); + if (tmr_rd == -1 && errno == EAGAIN) return 1; + if (tmr_rd < 0) { + perror("read on timer"); + fprintf(stderr, "An error occured on timer fd=%d\n", fdinfo->fd); + exit(EXIT_FAILURE); + } + struct algo_ctx* app_ctx = fdinfo->cat->app_ctx; struct rr_ctx* rr = app_ctx->misc; struct waited_pkt* pkt = fdinfo->other; - evt_core_rm_fd(ctx, fdinfo->fd); pkt->on = 0; if (ring_gt (pkt->id, rr->recv_id_late)) rr->recv_id_late = pkt->id; if (ring_le (pkt->id, rr->recv_id)) return 1; @@ -424,6 +433,7 @@ int rr_on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { rr_pkt_unroll (ctx, app_ctx); } + evt_core_rm_fd(ctx, fdinfo->fd); return 1; } diff --git a/src/algo_utils.c b/src/algo_utils.c index b483c46..2db616a 100644 --- a/src/algo_utils.c +++ b/src/algo_utils.c @@ -126,7 +126,8 @@ void mv_buffer_rtoa(struct algo_ctx* app_ctx, struct evt_core_fdinfo* from, void } g_hash_table_remove(app_ctx->used_buffer, &from->fd); if (g_hash_table_contains(app_ctx->application_waiting, to)) { - fprintf(stderr, "Data already exist for this entry\n"); + fprintf(stderr, "Data already exists for this entry\n"); + debug_buffer(app_ctx, from); exit(EXIT_FAILURE); } g_hash_table_insert(app_ctx->application_waiting, to, bp); diff --git a/src/meas_lat.c b/src/meas_lat.c index ebf39be..1eb76ed 100644 --- a/src/meas_lat.c +++ b/src/meas_lat.c @@ -96,7 +96,7 @@ int on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) { struct measure_conf* mc = fdinfo->other; s = read(fdinfo->fd, &ticks, sizeof(uint64_t)); - if (s == -1 && errno == EAGAIN) return 0; + if (s == -1 && errno == EAGAIN) return 1; if (s != sizeof(uint64_t)) { perror("Read error"); exit(EXIT_FAILURE); diff --git a/src/net_tools.c b/src/net_tools.c index 18b5890..0b01658 100644 --- a/src/net_tools.c +++ b/src/net_tools.c @@ -109,6 +109,7 @@ int create_tcp_server(char* host, char* service) { perror("setsockopt TCP_NODELAY"); exit(EXIT_FAILURE); } + return sock; }