Skip to content

Commit 6e46f0b

Browse files
committed
BUG/MEDIUM: mux-spop; Don't report a read error if there are pending data
When an read error is detected, no error must be reported on the SPOP connection is there are still some data to parse. It is important to be sure to process all data before reporting the error and be sure to not truncate received frames. However, we must also take care to handle short read case to not wait data that will never be received. This patch must be backported to 3.1.
1 parent 16314bb commit 6e46f0b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mux_spop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2381,7 +2381,8 @@ static int spop_recv(struct spop_conn *spop_conn)
23812381
TRACE_DATA("received read0", SPOP_EV_SPOP_CONN_RECV, conn);
23822382
spop_conn->flags |= SPOP_CF_RCVD_SHUT;
23832383
}
2384-
if (conn->flags & CO_FL_ERROR) {
2384+
if ((conn->flags & CO_FL_ERROR) &&
2385+
(!b_data(&spop_conn->dbuf) || (spop_conn->flags & SPOP_CF_DEM_SHORT_READ))) {
23852386
TRACE_DATA("connection error", SPOP_EV_SPOP_CONN_RECV, conn);
23862387
spop_conn->flags |= SPOP_CF_ERROR;
23872388
}

0 commit comments

Comments
 (0)