buffer_timed_put.c (370B)
1 /* ISC license. */ 2 3 #include <stddef.h> 4 5 #include <skalibs/buffer.h> 6 #include <skalibs/unix-timed.h> 7 8 size_t buffer_timed_put (buffer *b, char const *s, size_t len, tain const *deadline, tain *stamp) 9 { 10 size_t w = 0 ; 11 for (;;) 12 { 13 w += buffer_putnoflush(b, s + w, len - w) ; 14 if (w >= len || !buffer_timed_flush(b, deadline, stamp)) break ; 15 } 16 return w ; 17 }