Fix some errors
This commit is contained in:
parent
721f4ea54f
commit
192f355121
1 changed files with 7 additions and 3 deletions
|
@ -71,6 +71,9 @@ void algo_lightning_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < lightc->sent_past_links; i++)
|
||||||
|
lightc->prev_links[i] = UINT8_MAX;
|
||||||
|
|
||||||
union abstract_packet m;
|
union abstract_packet m;
|
||||||
lightc->monit_pkt_size = sizeof(m.fmt.headers) + sizeof(m.fmt.content.link_monitoring_lightning) + sizeof(uint8_t) * (lightc->sent_past_links - 1);
|
lightc->monit_pkt_size = sizeof(m.fmt.headers) + sizeof(m.fmt.content.link_monitoring_lightning) + sizeof(uint8_t) * (lightc->sent_past_links - 1);
|
||||||
timespec_set_unit (&lightc->window, window, MILISEC);
|
timespec_set_unit (&lightc->window, window, MILISEC);
|
||||||
|
@ -155,6 +158,8 @@ void algo_lightning_update_stats (struct light_ctx *lightc, int64_t *stats) {
|
||||||
|
|
||||||
for (int i = 0; i < HISTORIC_SIZE; i++) {
|
for (int i = 0; i < HISTORIC_SIZE; i++) {
|
||||||
if (timespec_lt(&lightc->historic[i].finished_at, ¬_before)) continue;
|
if (timespec_lt(&lightc->historic[i].finished_at, ¬_before)) continue;
|
||||||
|
uint8_t l = lightc->historic[i].link_id;
|
||||||
|
if (l >= lightc->total_links) continue;
|
||||||
int64_t delta = 0;
|
int64_t delta = 0;
|
||||||
switch (lightc->historic[i].state) {
|
switch (lightc->historic[i].state) {
|
||||||
case IN_ORDER:
|
case IN_ORDER:
|
||||||
|
@ -168,7 +173,7 @@ void algo_lightning_update_stats (struct light_ctx *lightc, int64_t *stats) {
|
||||||
delta = timespec_get_unit (&temp_time, MILISEC);
|
delta = timespec_get_unit (&temp_time, MILISEC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
uint8_t l = lightc->historic[i].link_id;
|
|
||||||
stats[l] = delta > stats[l] ? delta : stats[l];
|
stats[l] = delta > stats[l] ? delta : stats[l];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,6 +196,7 @@ int send_message(struct evt_core_ctx* ctx, struct buffer_packet* bp) {
|
||||||
|
|
||||||
struct buffer_packet* bp_dup = dup_buffer_tow (&app_ctx->br, bp, to_fdinfo);
|
struct buffer_packet* bp_dup = dup_buffer_tow (&app_ctx->br, bp, to_fdinfo);
|
||||||
|
|
||||||
|
lightc->pkt_sent_id++;
|
||||||
union abstract_packet monit = {
|
union abstract_packet monit = {
|
||||||
.fmt.headers.cmd = CMD_LINK_MONITORING_LIGHTNING,
|
.fmt.headers.cmd = CMD_LINK_MONITORING_LIGHTNING,
|
||||||
.fmt.headers.size = lightc->monit_pkt_size,
|
.fmt.headers.size = lightc->monit_pkt_size,
|
||||||
|
@ -204,7 +210,6 @@ int send_message(struct evt_core_ctx* ctx, struct buffer_packet* bp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
lightc->prev_links[lightc->pkt_sent_id % MAX_LINKS] = lightc->selected_link;
|
lightc->prev_links[lightc->pkt_sent_id % MAX_LINKS] = lightc->selected_link;
|
||||||
lightc->pkt_sent_id++;
|
|
||||||
|
|
||||||
if (ctx->verbose > 1) {
|
if (ctx->verbose > 1) {
|
||||||
dump_buffer_packet(bp_dup);
|
dump_buffer_packet(bp_dup);
|
||||||
|
@ -239,7 +244,6 @@ int algo_lightning_on_datagram(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
||||||
int64_t cdelta = stats[lightc->selected_link];
|
int64_t cdelta = stats[lightc->selected_link];
|
||||||
|
|
||||||
// OK link
|
// OK link
|
||||||
printf("cdelta=%ld\n", cdelta);
|
|
||||||
if (cdelta < lightc->max_ooo) {
|
if (cdelta < lightc->max_ooo) {
|
||||||
send_message (ctx, bp);
|
send_message (ctx, bp);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue