Register packet only if not already delivered!

This commit is contained in:
Quentin 2019-05-14 13:56:19 +02:00
parent 05384a424a
commit f94d2109d9

View file

@ -67,7 +67,7 @@ void rr_pkt_register(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo,
} }
printf("] - could be replaced by drop\n"); printf("] - could be replaced by drop\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} else if (!rr->real[real_idx].on) { } else if (!rr->real[real_idx].on && ring_gt(bp->ip.ap.fmt.content.clear.id, rr->content_id)) {
rr->real[real_idx].on = 1; rr->real[real_idx].on = 1;
rr->real[real_idx].id = bp->ip.ap.fmt.content.clear.id; rr->real[real_idx].id = bp->ip.ap.fmt.content.clear.id;
rr->real[real_idx].idx = real_idx; rr->real[real_idx].idx = real_idx;
@ -75,7 +75,7 @@ void rr_pkt_register(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo,
rr->real[real_idx].algo = app_ctx; rr->real[real_idx].algo = app_ctx;
mv_buffer_rtoa(app_ctx, fdinfo, &rr->real[real_idx].idx); mv_buffer_rtoa(app_ctx, fdinfo, &rr->real[real_idx].idx);
} else { } else {
fprintf(stdout, "Packet %d already received (current: %d)\n", bp->ip.ap.fmt.content.clear.id, rr->content_id); if (ctx->verbose) fprintf(stdout, "Packet %d already received (current: %d)\n", bp->ip.ap.fmt.content.clear.id, rr->content_id);
mv_buffer_rtof (app_ctx, fdinfo); mv_buffer_rtof (app_ctx, fdinfo);
} }
} }
@ -301,6 +301,7 @@ void on_timeout_health (struct evt_core_ctx* ctx, void* raw) {
} }
// 3. Deliver blocked packets // 3. Deliver blocked packets
//printf("t->min_blocked_pkt=%d, rr->content_id=%d\n", t->min_blocked_pkt, rr->content_id);
while (ring_gt(t->min_blocked_pkt, rr->content_id)) { while (ring_gt(t->min_blocked_pkt, rr->content_id)) {
rr->content_id++; rr->content_id++;
rr_pkt_unroll (ctx, app_ctx); rr_pkt_unroll (ctx, app_ctx);