Something that might work
This commit is contained in:
parent
acae81b91c
commit
b6258759f0
4 changed files with 15 additions and 3 deletions
|
@ -403,11 +403,20 @@ co_error:
|
||||||
}
|
}
|
||||||
|
|
||||||
int rr_on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
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 algo_ctx* app_ctx = fdinfo->cat->app_ctx;
|
||||||
struct rr_ctx* rr = app_ctx->misc;
|
struct rr_ctx* rr = app_ctx->misc;
|
||||||
|
|
||||||
struct waited_pkt* pkt = fdinfo->other;
|
struct waited_pkt* pkt = fdinfo->other;
|
||||||
evt_core_rm_fd(ctx, fdinfo->fd);
|
|
||||||
pkt->on = 0;
|
pkt->on = 0;
|
||||||
if (ring_gt (pkt->id, rr->recv_id_late)) rr->recv_id_late = pkt->id;
|
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;
|
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);
|
rr_pkt_unroll (ctx, app_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
evt_core_rm_fd(ctx, fdinfo->fd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
g_hash_table_remove(app_ctx->used_buffer, &from->fd);
|
||||||
if (g_hash_table_contains(app_ctx->application_waiting, to)) {
|
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);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
g_hash_table_insert(app_ctx->application_waiting, to, bp);
|
g_hash_table_insert(app_ctx->application_waiting, to, bp);
|
||||||
|
|
|
@ -96,7 +96,7 @@ int on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
||||||
struct measure_conf* mc = fdinfo->other;
|
struct measure_conf* mc = fdinfo->other;
|
||||||
|
|
||||||
s = read(fdinfo->fd, &ticks, sizeof(uint64_t));
|
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)) {
|
if (s != sizeof(uint64_t)) {
|
||||||
perror("Read error");
|
perror("Read error");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
@ -109,6 +109,7 @@ int create_tcp_server(char* host, char* service) {
|
||||||
perror("setsockopt TCP_NODELAY");
|
perror("setsockopt TCP_NODELAY");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sock;
|
return sock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue