mirror of
https://github.com/cesanta/mongoose.git
synced 2025-06-08 01:42:52 +08:00
fix broken TCP closure
This commit is contained in:
parent
539d080346
commit
ae8422e304
@ -4338,6 +4338,7 @@ static void settmout(struct mg_connection *c, uint8_t type) {
|
|||||||
: type == MIP_TTYPE_SYN ? MIP_TCP_SYN_MS
|
: type == MIP_TTYPE_SYN ? MIP_TCP_SYN_MS
|
||||||
: type == MIP_TTYPE_FIN ? MIP_TCP_FIN_MS
|
: type == MIP_TTYPE_FIN ? MIP_TCP_FIN_MS
|
||||||
: MIP_TCP_KEEPALIVE_MS;
|
: MIP_TCP_KEEPALIVE_MS;
|
||||||
|
if (s->ttype == MIP_TTYPE_FIN) return; // skip if 3-way closing
|
||||||
s->timer = ifp->now + n;
|
s->timer = ifp->now + n;
|
||||||
s->ttype = type;
|
s->ttype = type;
|
||||||
MG_VERBOSE(("%lu %d -> %llx", c->id, type, s->timer));
|
MG_VERBOSE(("%lu %d -> %llx", c->id, type, s->timer));
|
||||||
@ -5361,7 +5362,6 @@ void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
|
|||||||
if (s->twclosure &&
|
if (s->twclosure &&
|
||||||
(!c->is_tls || (c->rtls.len == 0 && mg_tls_pending(c) == 0)))
|
(!c->is_tls || (c->rtls.len == 0 && mg_tls_pending(c) == 0)))
|
||||||
c->is_closing = 1;
|
c->is_closing = 1;
|
||||||
if (c->is_draining && c->send.len == 0) c->is_closing = 1;
|
|
||||||
if (c->is_closing) close_conn(c);
|
if (c->is_closing) close_conn(c);
|
||||||
}
|
}
|
||||||
(void) ms;
|
(void) ms;
|
||||||
|
@ -176,6 +176,7 @@ static void settmout(struct mg_connection *c, uint8_t type) {
|
|||||||
: type == MIP_TTYPE_SYN ? MIP_TCP_SYN_MS
|
: type == MIP_TTYPE_SYN ? MIP_TCP_SYN_MS
|
||||||
: type == MIP_TTYPE_FIN ? MIP_TCP_FIN_MS
|
: type == MIP_TTYPE_FIN ? MIP_TCP_FIN_MS
|
||||||
: MIP_TCP_KEEPALIVE_MS;
|
: MIP_TCP_KEEPALIVE_MS;
|
||||||
|
if (s->ttype == MIP_TTYPE_FIN) return; // skip if 3-way closing
|
||||||
s->timer = ifp->now + n;
|
s->timer = ifp->now + n;
|
||||||
s->ttype = type;
|
s->ttype = type;
|
||||||
MG_VERBOSE(("%lu %d -> %llx", c->id, type, s->timer));
|
MG_VERBOSE(("%lu %d -> %llx", c->id, type, s->timer));
|
||||||
@ -1199,7 +1200,6 @@ void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
|
|||||||
if (s->twclosure &&
|
if (s->twclosure &&
|
||||||
(!c->is_tls || (c->rtls.len == 0 && mg_tls_pending(c) == 0)))
|
(!c->is_tls || (c->rtls.len == 0 && mg_tls_pending(c) == 0)))
|
||||||
c->is_closing = 1;
|
c->is_closing = 1;
|
||||||
if (c->is_draining && c->send.len == 0) c->is_closing = 1;
|
|
||||||
if (c->is_closing) close_conn(c);
|
if (c->is_closing) close_conn(c);
|
||||||
}
|
}
|
||||||
(void) ms;
|
(void) ms;
|
||||||
|
Loading…
Reference in New Issue
Block a user