Style: always braces around if + else

This commit is contained in:
cpq committed 2023-08-25 14:46:38 +01:00
1 parent 41448278cf
commit e8d57ac4e1
2 files changed
+12 -12

No files matched your search

+6 -6
View File
@@ -4426,11 +4426,11 @@ static void read_conn(struct mg_connection *c, struct pkt *pkt) {
uint8_t flags = TH_ACK; uint8_t flags = TH_ACK;
s->ack = (uint32_t) (mg_htonl(pkt->tcp->seq) + pkt->pay.len + 1); s->ack = (uint32_t) (mg_htonl(pkt->tcp->seq) + pkt->pay.len + 1);
if (c->is_draining && s->ttype == MIP_TTYPE_FIN) { if (c->is_draining && s->ttype == MIP_TTYPE_FIN) {
if (s->seq == mg_htonl(pkt->tcp->ack)) if (s->seq == mg_htonl(pkt->tcp->ack)) { // Simultaneous closure ?
// Checking for simultaneous closure s->seq++; // Yes. Increment our SEQ
s->seq++; } else { // Otherwise,
else s->seq = mg_htonl(pkt->tcp->ack); // Set to peer's ACK
s->seq = mg_htonl(pkt->tcp->ack); }
} else { } else {
flags |= TH_FIN; flags |= TH_FIN;
c->is_draining = 1; 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); rx_ip(ifp, &pkt);
} else { } else {
MG_DEBUG(("Unknown eth type %x", mg_htons(pkt.eth->type))); 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);
} }
} }
+6 -6
View File
@@ -595,11 +595,11 @@ static void read_conn(struct mg_connection *c, struct pkt *pkt) {
uint8_t flags = TH_ACK; uint8_t flags = TH_ACK;
s->ack = (uint32_t) (mg_htonl(pkt->tcp->seq) + pkt->pay.len + 1); s->ack = (uint32_t) (mg_htonl(pkt->tcp->seq) + pkt->pay.len + 1);
if (c->is_draining && s->ttype == MIP_TTYPE_FIN) { if (c->is_draining && s->ttype == MIP_TTYPE_FIN) {
if (s->seq == mg_htonl(pkt->tcp->ack)) if (s->seq == mg_htonl(pkt->tcp->ack)) { // Simultaneous closure ?
// Checking for simultaneous closure s->seq++; // Yes. Increment our SEQ
s->seq++; } else { // Otherwise,
else s->seq = mg_htonl(pkt->tcp->ack); // Set to peer's ACK
s->seq = mg_htonl(pkt->tcp->ack); }
} else { } else {
flags |= TH_FIN; flags |= TH_FIN;
c->is_draining = 1; 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); rx_ip(ifp, &pkt);
} else { } else {
MG_DEBUG(("Unknown eth type %x", mg_htons(pkt.eth->type))); 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);
} }
} }