Better handle timeouts

This commit is contained in:
Quentin 2019-08-29 18:11:50 +02:00
parent 5ed70a0848
commit 124c0375c0
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ struct thunder_ctx {
uint16_t emit_id;
uint8_t selected_link;
uint8_t total_links;
uint8_t delta_t_per_link[MAX_LINKS];
uint64_t delta_t_per_link[MAX_LINKS];
uint64_t received_pkts_on_link[MAX_LINKS];
uint64_t blacklisted[MAX_LINKS];
size_t monit_pkt_size;
@ -132,13 +132,13 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu
union abstract_packet *new_ap = buffer_append_ap (bp_dup, &links);
// 4. We compute the time difference
uint64_t mili_sec = compute_delta (&thunderc->prev_link_time, 200);
uint64_t mili_sec = compute_delta (&thunderc->prev_link_time, UINT16_MAX);
// 5. We create the array
struct link_info *li = &new_ap->fmt.content.link_monitoring_thunder.links_status;
for (int i = 0; i < thunderc->total_links; i++) {
thunderc->delta_t_per_link[i] += mili_sec;
li[i].delta_t = thunderc->delta_t_per_link[i];
li[i].delta_t = thunderc->delta_t_per_link[i] > UINT16_MAX ? UINT16_MAX : thunderc->delta_t_per_link[i];
}
li[thunderc->selected_link].delta_t = 0;
@ -315,7 +315,7 @@ void algo_thunder_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, struc
thunderc->recv_id = 1;
thunderc->emit_id = 1;
thunderc->total_links = app_ctx->ap.links;
thunderc->selected_link = thunderc->total_links;
thunderc->selected_link = thunderc->total_links - 1;
for (int i = 0; i < MAX_LINKS; i++) thunderc->received_pkts_on_link[i] = 1;
union abstract_packet links = {};

View file

@ -43,7 +43,7 @@ enum PKT_FLAGS {
};
struct link_info {
uint8_t delta_t;
uint16_t delta_t;
};
union abstract_packet {