From e8d57ac4e114e89b3b56f8a16b44c60594753744 Mon Sep 17 00:00:00 2001 From: cpq Date: Fri, 25 Aug 2023 14:46:38 +0100 Subject: [PATCH] Style: always braces around if + else --- mongoose.c | 12 ++++++------ src/net_builtin.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mongoose.c b/mongoose.c index 27c495c695..9edde71d4b 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4426,11 +4426,11 @@ static void read_conn(struct mg_connection *c, struct pkt *pkt) { uint8_t flags = TH_ACK; s->ack = (uint32_t) (mg_htonl(pkt->tcp->seq) + pkt->pay.len + 1); if (c->is_draining && s->ttype == MIP_TTYPE_FIN) { - if (s->seq == mg_htonl(pkt->tcp->ack)) - // Checking for simultaneous closure - s->seq++; - else - s->seq = mg_htonl(pkt->tcp->ack); + if (s->seq == mg_htonl(pkt->tcp->ack)) { // Simultaneous closure ? + s->seq++; // Yes. Increment our SEQ + } else { // Otherwise, + s->seq = mg_htonl(pkt->tcp->ack); // Set to peer's ACK + } } else { flags |= TH_FIN; c->is_draining = 1; @@ -4645,7 +4645,7 @@ static void mg_tcpip_rx(struct mg_tcpip_if *ifp, void *buf, size_t len) { rx_ip(ifp, &pkt); } else { MG_DEBUG(("Unknown eth type %x", mg_htons(pkt.eth->type))); - //mg_hexdump(buf, len >= 32 ? 32 : len); + mg_hexdump(buf, len >= 32 ? 32 : len); } } diff --git a/src/net_builtin.c b/src/net_builtin.c index 5f4caa9b4d..47049f1429 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -595,11 +595,11 @@ static void read_conn(struct mg_connection *c, struct pkt *pkt) { uint8_t flags = TH_ACK; s->ack = (uint32_t) (mg_htonl(pkt->tcp->seq) + pkt->pay.len + 1); if (c->is_draining && s->ttype == MIP_TTYPE_FIN) { - if (s->seq == mg_htonl(pkt->tcp->ack)) - // Checking for simultaneous closure - s->seq++; - else - s->seq = mg_htonl(pkt->tcp->ack); + if (s->seq == mg_htonl(pkt->tcp->ack)) { // Simultaneous closure ? + s->seq++; // Yes. Increment our SEQ + } else { // Otherwise, + s->seq = mg_htonl(pkt->tcp->ack); // Set to peer's ACK + } } else { flags |= TH_FIN; c->is_draining = 1; @@ -814,7 +814,7 @@ static void mg_tcpip_rx(struct mg_tcpip_if *ifp, void *buf, size_t len) { rx_ip(ifp, &pkt); } else { MG_DEBUG(("Unknown eth type %x", mg_htons(pkt.eth->type))); - //mg_hexdump(buf, len >= 32 ? 32 : len); + mg_hexdump(buf, len >= 32 ? 32 : len); } }