Skip to content

Commit 041ec6e

Browse files
committed
Close if drained
1 parent f618fe1 commit 041ec6e

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

mongoose.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5361,6 +5361,7 @@ void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
53615361
if (s->twclosure &&
53625362
(!c->is_tls || (c->rtls.len == 0 && mg_tls_pending(c) == 0)))
53635363
c->is_closing = 1;
5364+
if (c->is_draining && c->send.len == 0) c->is_closing = 1;
53645365
if (c->is_closing) close_conn(c);
53655366
}
53665367
(void) ms;

src/net_builtin.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,7 @@ void mg_mgr_poll(struct mg_mgr *mgr, int ms) {
11991199
if (s->twclosure &&
12001200
(!c->is_tls || (c->rtls.len == 0 && mg_tls_pending(c) == 0)))
12011201
c->is_closing = 1;
1202+
if (c->is_draining && c->send.len == 0) c->is_closing = 1;
12021203
if (c->is_closing) close_conn(c);
12031204
}
12041205
(void) ms;

0 commit comments

Comments
 (0)