From 2766a94e3bcf2a98c41adb0c312c24229585c57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Mon, 16 Dec 2019 09:43:36 +0000 Subject: [PATCH] Code cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- mud.c | 14 +++++++------- mud.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mud.c b/mud.c index 079c292..97906b9 100644 --- a/mud.c +++ b/mud.c @@ -568,7 +568,7 @@ mud_reset_path(struct mud_path *path) { path->window = 0; path->ok = 0; - path->msg_sent = 0; + path->msg.sent = 0; path->loss_count = 0; } @@ -1146,8 +1146,8 @@ mud_send_msg(struct mud *mud, struct mud_path *path, uint64_t now, msg->loss = (unsigned char)path->tx.loss; if (!mud->peer.set || !sent_time) { - if (path->msg_sent < MUD_MSG_SENT_MAX) - path->msg_sent++; + if (path->msg.sent < MUD_MSG_SENT_MAX) + path->msg.sent++; } const struct mud_crypto_opt opt = { @@ -1316,7 +1316,7 @@ mud_recv_msg(struct mud *mud, struct mud_path *path, } path->rx.loss = (uint64_t)msg->loss; - path->msg_sent = 0; + path->msg.sent = 0; path->ok = 1; if (!mud->peer.set) @@ -1445,7 +1445,7 @@ mud_update(struct mud *mud) } if (mud->peer.set) { - if (path->msg_sent >= MUD_MSG_SENT_MAX) { + if (path->msg.sent >= MUD_MSG_SENT_MAX) { if (path->mtu.probe == MUD_MTU_MIN) { mud_reset_path(path); } else { @@ -1454,14 +1454,14 @@ mud_update(struct mud *mud) path->mtu.ok = MUD_MTU_MIN; mud_reset_path(path); } else { - path->msg_sent = 0; + path->msg.sent = 0; } path->mtu.max = path->mtu.probe - 1; path->mtu.probe = (path->mtu.min + path->mtu.max) >> 1; } } } else { - if ((path->msg_sent >= MUD_MSG_SENT_MAX) || + if ((path->msg.sent >= MUD_MSG_SENT_MAX) || (path->rx.time && mud->last_recv_time > path->rx.time + MUD_ONE_SEC)) { mud_remove_path(path); diff --git a/mud.h b/mud.h index c862f05..34f7c88 100644 --- a/mud.h +++ b/mud.h @@ -44,6 +44,7 @@ struct mud_path { struct { uint64_t time; uint64_t timeout; + uint64_t sent; uint64_t set; } msg; struct { @@ -56,7 +57,6 @@ struct mud_path { uint64_t window_time; struct mud_pubkey pk; unsigned char ok; - unsigned msg_sent; int loss_count; };