Add mud_sync()

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2018-06-15 10:05:42 +00:00
parent 03be90b606
commit 22e065e5cb
2 changed files with 5 additions and 2 deletions

5
mud.c
View File

@@ -502,9 +502,12 @@ mud_cmp_addr(struct sockaddr_storage *a, struct sockaddr_storage *b)
} }
unsigned long unsigned long
mud_get_sync_elapsed_msec(struct mud *mud) mud_sync(struct mud *mud)
{ {
const uint64_t last = mud->last_recv_time; 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; return last ? MUD_TIME_MASK(mud_now() - last) / MUD_ONE_MSEC : ~0UL;
} }

2
mud.h
View File

@@ -70,7 +70,7 @@ int mud_get_key (struct mud *, unsigned char *, size_t *);
void mud_set_mtu (struct mud *, size_t); void mud_set_mtu (struct mud *, size_t);
size_t mud_get_mtu (struct mud *); 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_send_timeout (struct mud *, unsigned long);
int mud_set_time_tolerance (struct mud *, unsigned long); int mud_set_time_tolerance (struct mud *, unsigned long);