[vlc-devel] [PATCH 2/2] network: tls: Handle errors from older kernels
hugo at beauzee.fr
Fri Mar 29 11:35:17 CET 2019
If MSG_FASTOPEN is defined, but turns out to be unimplemented by the
underlying kernel (as is the case on android where the NDK claims to
support fast open but some older kernels don't) EPIPE is returned
instead of EOPNOTSUPP.
See net/ipv4/tcp.c:936 & net/core/stream.c:55
sk_stream_wait_connect will return EPIPE if no SYN was sent/received,
and sendmsg will propagate that error.
Treating EPIPE as a synonym for EOPNOTSUPP here allows us to fallback
on the regular connect + send, instead of an hard error.
src/network/stream.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/network/stream.c b/src/network/stream.c
index 5a24bd7134..d38b2f2680 100644
@@ -383,8 +383,12 @@ static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls,
- if (errno != EOPNOTSUPP)
+ if (errno != EOPNOTSUPP && errno != EPIPE)
+ /* If MSG_FASTOPEN was defined but the kernel doesn't support fast open at
+ all, EPIPE will be returned instead of EOPNOTSUPP */
/* Fast open not supported or disabled... fallback to normal mode */
More information about the vlc-devel