diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2025-08-29 20:20:25 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska@appnovation.com> | 2025-08-29 20:20:25 +0000 |
| commit | c548d06d3857295b72c1f993d15480a21935a9a7 (patch) | |
| tree | 38693d4930e234ebb5a6da65d580f800bc228129 | |
| parent | eb45d9077cc77115f9804814f046be2379e007b7 (diff) | |
| download | tipidee-c548d06d3857295b72c1f993d15480a21935a9a7.tar.gz | |
Uncork when a stream_infinite() ends
Signed-off-by: Laurent Bercot <ska@appnovation.com>
| -rw-r--r-- | src/tipideed/stream.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 <skalibs/nonposix.h> +#include <sys/socket.h> +#include <netinet/tcp.h> #include <errno.h> #include <fcntl.h> #include <stdint.h> @@ -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") ; } |
