summaryrefslogtreecommitdiffstats
path: root/src/shared/sockhelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/sockhelper.c')
-rw-r--r--src/shared/sockhelper.c12
1 files changed, 12 insertions, 0 deletions
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