diff --git a/mud.c b/mud.c index 91723db..3a0cdda 100644 --- a/mud.c +++ b/mud.c @@ -502,9 +502,12 @@ mud_cmp_addr(struct sockaddr_storage *a, struct sockaddr_storage *b) } unsigned long -mud_get_sync_elapsed_msec(struct mud *mud) +mud_sync(struct mud *mud) { const uint64_t last = mud->last_recv_time; + + mud_send(mud, NULL, 0, 0); + return last ? MUD_TIME_MASK(mud_now() - last) / MUD_ONE_MSEC : ~0UL; } diff --git a/mud.h b/mud.h index 6be2827..09f0694 100644 --- a/mud.h +++ b/mud.h @@ -70,7 +70,7 @@ int mud_get_key (struct mud *, unsigned char *, size_t *); void mud_set_mtu (struct mud *, size_t); size_t mud_get_mtu (struct mud *); -unsigned long mud_get_sync_elapsed_msec (struct mud *); +unsigned long mud_sync (struct mud *); int mud_set_send_timeout (struct mud *, unsigned long); int mud_set_time_tolerance (struct mud *, unsigned long);