Skip to content

Commit cd91838

Browse files
committed
BUG/MEDIUM: stconn: Fix abort on close when a large buffer is used
When a large buffer is used on a channel, once we've started to send data to the opposite side, receives are blocked temporarily to be sure to flush the large buffer ASAP to be able to fall back on regular buffers. This was performed by skipping call to the endpoint (connection or applet). Howerver, doing so, this broken the abortonclose and more generally this masked any shut or error events reported by the lower layer. To fix the issue, instead of skipping receives, we now try a receive but with a requested size set to 0. No backport needed
1 parent b3be3b9 commit cd91838

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/stconn.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,10 +1149,6 @@ int sc_conn_recv(struct stconn *sc)
11491149
if (!sc_alloc_ibuf(sc, &(__sc_strm(sc)->buffer_wait)))
11501150
goto end_recv;
11511151

1152-
if ((ic->flags & CF_WROTE_DATA) && b_size(sc_ib(sc)) > global.tune.bufsize) {
1153-
sc_need_room(sc, -1);
1154-
goto done_recv;
1155-
}
11561152
/* For an HTX stream, if the buffer is stuck (no output data with some
11571153
* input data) and if the HTX message is fragmented or if its free space
11581154
* wraps, we force an HTX deframentation. It is a way to have a
@@ -1194,6 +1190,8 @@ int sc_conn_recv(struct stconn *sc)
11941190
* SE_FL_RCV_MORE on the SC if more space is needed.
11951191
*/
11961192
max = channel_recv_max(ic);
1193+
if ((ic->flags & CF_WROTE_DATA) && b_is_large(sc_ib(sc)))
1194+
max = 0;
11971195
ret = CALL_MUX_WITH_RET(conn->mux, rcv_buf(sc, &ic->buf, max, cur_flags));
11981196

11991197
if (sc_ep_test(sc, SE_FL_WANT_ROOM)) {
@@ -1838,11 +1836,6 @@ int sc_applet_recv(struct stconn *sc)
18381836
if (!sc_alloc_ibuf(sc, &appctx->buffer_wait))
18391837
goto end_recv;
18401838

1841-
if ((ic->flags & CF_WROTE_DATA) && b_size(sc_ib(sc)) > global.tune.bufsize) {
1842-
sc_need_room(sc, -1);
1843-
goto done_recv;
1844-
}
1845-
18461839
/* For an HTX stream, if the buffer is stuck (no output data with some
18471840
* input data) and if the HTX message is fragmented or if its free space
18481841
* wraps, we force an HTX deframentation. It is a way to have a
@@ -1868,6 +1861,8 @@ int sc_applet_recv(struct stconn *sc)
18681861
* SE_FL_RCV_MORE on the SC if more space is needed.
18691862
*/
18701863
max = channel_recv_max(ic);
1864+
if ((ic->flags & CF_WROTE_DATA) && b_is_large(sc_ib(sc)))
1865+
max = 0;
18711866
ret = appctx_rcv_buf(sc, &ic->buf, max, flags);
18721867
if (sc_ep_test(sc, SE_FL_WANT_ROOM)) {
18731868
/* SE_FL_WANT_ROOM must not be reported if the channel's

0 commit comments

Comments
 (0)