From c548d06d3857295b72c1f993d15480a21935a9a7 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 29 Aug 2025 20:20:25 +0000 Subject: Uncork when a stream_infinite() ends Signed-off-by: Laurent Bercot --- src/tipideed/stream.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/tipideed/stream.c b/src/tipideed/stream.c index a0bdbd2..a5f78cc 100644 --- a/src/tipideed/stream.c +++ b/src/tipideed/stream.c @@ -6,6 +6,8 @@ #include +#include +#include #include #include #include @@ -27,6 +29,13 @@ struct fixed_info_s uint64_t n ; } ; +static inline void uncork (int fd) +{ + static int const val = 0 ; + if (setsockopt(fd, SOL_TCP, TCP_CORK, &val, sizeof(int)) == -1 && g.logv) + strerr_warnwu1sys("uncork stdout") ; +} + static int fixed_getfd (void *b) { struct fixed_info_s *si = b ; @@ -70,6 +79,7 @@ void stream_infinite (int fd, char const *fn) /* You WISH you had written that line of code */ if (r == -1) strerr_diefu3sys(111, "splice from ", fn, " to stdout") ; + uncork(1) ; if (ndelay_on(1) == -1) strerr_diefu1sys(111, "set stdout nonblocking again") ; } -- cgit v1.3.1