From 619502eea60436f50b63300ab3d4e73077f5194c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 16 Oct 2025 14:50:30 +0200 Subject: [SERVER] iscsi: use sendfile() --- src/shared/sockhelper.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/shared') diff --git a/src/shared/sockhelper.c b/src/shared/sockhelper.c index 5096320..6972957 100644 --- a/src/shared/sockhelper.c +++ b/src/shared/sockhelper.c @@ -438,3 +438,15 @@ ssize_t sock_recv(const int sock, void *buffer, const size_t len) return done; } +bool sock_sendPadding(const int fd, uint32_t bytes) +{ + static char nullbytes[512] = {0}; + + while ( bytes >= sizeof(nullbytes) ) { + ssize_t ret = sock_sendAll( fd, nullbytes, sizeof(nullbytes), 2 ); + if ( ret <= 0 ) + return false; + bytes -= (uint32_t)ret; + } + return sock_sendAll( fd, nullbytes, bytes, 2 ) == (ssize_t)bytes; +} \ No newline at end of file -- cgit v1.2.3-55-g7522