summaryrefslogtreecommitdiff
path: root/src/libunixonacid/buffer_timed_put.c
blob: a64546553ffbc4ce329de83178fce1ee71b8047e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* ISC license. */

#include <stddef.h>

#include <skalibs/buffer.h>
#include <skalibs/unix-timed.h>

size_t buffer_timed_put (buffer *b, char const *s, size_t len, tain const *deadline, tain *stamp)
{
  size_t w = 0 ;
  for (;;)
  {
    w += buffer_putnoflush(b, s + w, len - w) ;
    if (w >= len || !buffer_timed_flush(b, deadline, stamp)) break ;
  }
  return w ;
}