Remove down paths after 10s of inactivity

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-07-17 14:59:28 +00:00
parent 14893f9ea9
commit 0ae6656bdb

6
mud.c
View File

@@ -1416,8 +1416,12 @@ mud_update(struct mud *mud, uint64_t now)
for (unsigned i = 0; i < mud->count; i++) { for (unsigned i = 0; i < mud->count; i++) {
struct mud_path *path = &mud->paths[i]; struct mud_path *path = &mud->paths[i];
if (path->state <= MUD_DOWN) if (path->state <= MUD_DOWN) {
if (path->state == MUD_DOWN &&
mud_timeout(now, path->recv.time, 10 * MUD_ONE_SEC))
path->state = MUD_EMPTY;
continue; continue;
}
if (mud->peer.set) { if (mud->peer.set) {
if (path->msg_sent >= MUD_MSG_SENT_MAX) { if (path->msg_sent >= MUD_MSG_SENT_MAX) {