Fix measlat
This commit is contained in:
parent
c4ec089d44
commit
a90018c871
1 changed files with 3 additions and 2 deletions
|
@ -36,6 +36,7 @@ void register_timer(struct evt_core_ctx* evts, struct timespec* next_tick) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
struct measlat_ctx* mctx = ucat->app_ctx;
|
struct measlat_ctx* mctx = ucat->app_ctx;
|
||||||
|
|
||||||
mctx->is_timer_started = 1;
|
mctx->is_timer_started = 1;
|
||||||
|
|
||||||
if (clock_gettime(CLOCK_REALTIME, &now) == -1) {
|
if (clock_gettime(CLOCK_REALTIME, &now) == -1) {
|
||||||
|
@ -98,7 +99,7 @@ int on_receive_measure_packet(struct evt_core_ctx* ctx, struct evt_core_fdinfo*
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to start sending from the server in sync with client
|
// Used to start sending from the server in sync with client
|
||||||
if (!mctx->is_timer_started) {
|
if (!mctx->is_timer_started && mctx->mc.counter <= mctx->mc.max_measure) {
|
||||||
struct timespec next_tick = {0};
|
struct timespec next_tick = {0};
|
||||||
measure_next_tick(&mctx->mc, &next_tick);
|
measure_next_tick(&mctx->mc, &next_tick);
|
||||||
register_timer (ctx, &next_tick);
|
register_timer (ctx, &next_tick);
|
||||||
|
@ -159,7 +160,7 @@ int on_timer(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
||||||
|
|
||||||
struct evt_core_fdinfo* tgtinfo = evt_core_get_first_from_cat (ctx, "udp-read");
|
struct evt_core_fdinfo* tgtinfo = evt_core_get_first_from_cat (ctx, "udp-read");
|
||||||
if (tgtinfo == NULL) tgtinfo = evt_core_get_first_from_cat (ctx, "tcp-read");
|
if (tgtinfo == NULL) tgtinfo = evt_core_get_first_from_cat (ctx, "tcp-read");
|
||||||
if (tgtinfo == NULL) {
|
if (tgtinfo == NULL || mctx->mc.counter > mctx->mc.max_measure) {
|
||||||
printf("No connection yet\n");
|
printf("No connection yet\n");
|
||||||
struct evt_core_fdinfo* timer_fd = evt_core_get_first_from_cat (ctx, "timer");
|
struct evt_core_fdinfo* timer_fd = evt_core_get_first_from_cat (ctx, "timer");
|
||||||
evt_core_rm_fd(ctx, timer_fd->fd);
|
evt_core_rm_fd(ctx, timer_fd->fd);
|
||||||
|
|
Loading…
Reference in a new issue