From 84e9ea76db0c29ce4e6549c204640d4a9dec7c5d Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 28 Oct 2025 10:15:35 -0300 Subject: [PATCH] wip --- mongoose.c | 9 ++++++++- src/net_builtin.c | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 5dd71c14..3dd88338 100644 --- a/mongoose.c +++ b/mongoose.c @@ -6100,8 +6100,14 @@ static void init_closure(struct mg_connection *c) { struct connstate *s = (struct connstate *) (c + 1); if (c->is_udp == false && c->is_listening == false && c->is_connecting == false) { // For TCP conns, +<<<<<<< HEAD tx_tcp(c->mgr->ifp, s->mac, &c->loc, &c->rem, TH_FIN | TH_ACK, mg_htonl(s->seq), mg_htonl(s->ack), NULL, 0); +======= + uint32_t rem_ip = c->rem.ip4; + tx_tcp(c->mgr->ifp, s->mac, rem_ip, TH_FIN | TH_ACK, c->loc.port, + c->rem.port, mg_htonl(s->seq), mg_htonl(s->ack), NULL, 0); +>>>>>>> 81b87991 (wip) settmout(c, MIP_TTYPE_FIN); } } @@ -6168,7 +6174,8 @@ bool mg_send(struct mg_connection *c, const void *buf, size_t len) { res = tx_udp(ifp, s->mac, &c->loc, &c->rem, buf, len); } else { res = mg_iobuf_add(&c->send, c->send.len, buf, len); - // res == 0 means an OOM condition (iobuf couldn't resize), yet this is so far recoverable, let the caller decide + // res == 0 means an OOM condition (iobuf couldn't resize), yet this is so + // far recoverable, let the caller decide } return res; } diff --git a/src/net_builtin.c b/src/net_builtin.c index d8face25..0c1acd1e 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -1936,8 +1936,14 @@ static void init_closure(struct mg_connection *c) { struct connstate *s = (struct connstate *) (c + 1); if (c->is_udp == false && c->is_listening == false && c->is_connecting == false) { // For TCP conns, +<<<<<<< HEAD tx_tcp(c->mgr->ifp, s->mac, &c->loc, &c->rem, TH_FIN | TH_ACK, mg_htonl(s->seq), mg_htonl(s->ack), NULL, 0); +======= + uint32_t rem_ip = c->rem.ip4; + tx_tcp(c->mgr->ifp, s->mac, rem_ip, TH_FIN | TH_ACK, c->loc.port, + c->rem.port, mg_htonl(s->seq), mg_htonl(s->ack), NULL, 0); +>>>>>>> 81b87991 (wip) settmout(c, MIP_TTYPE_FIN); } } @@ -2004,7 +2010,8 @@ bool mg_send(struct mg_connection *c, const void *buf, size_t len) { res = tx_udp(ifp, s->mac, &c->loc, &c->rem, buf, len); } else { res = mg_iobuf_add(&c->send, c->send.len, buf, len); - // res == 0 means an OOM condition (iobuf couldn't resize), yet this is so far recoverable, let the caller decide + // res == 0 means an OOM condition (iobuf couldn't resize), yet this is so + // far recoverable, let the caller decide } return res; }