diff options
Diffstat (limited to 'src/libnsss/nsss_switch_sendv.c')
-rw-r--r-- | src/libnsss/nsss_switch_sendv.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/libnsss/nsss_switch_sendv.c b/src/libnsss/nsss_switch_sendv.c new file mode 100644 index 0000000..2590686 --- /dev/null +++ b/src/libnsss/nsss_switch_sendv.c @@ -0,0 +1,25 @@ +/* ISC license. */ + +#include <errno.h> + +#include <skalibs/buffer.h> +#include <skalibs/unix-timed.h> + +#include <nsss/nsss-switch.h> +#include "nsss-switch-internal.h" + +int nsss_switch_sendv (nsss_switch_t *a, struct iovec const *v, unsigned int n, tain const *deadline, tain *stamp) +{ + if (!ipc_timed_sendv(buffer_fd(&a->b), v, n, deadline, stamp)) + { + unsigned int what ; + char const *path ; + if (errno != ECONNRESET || !a->path) return 0 ; + what = a->held ; + path = a->path ; + nsss_switch_end(a, what) ; + if (!nsss_switch_start(a, what, path, deadline, stamp)) return 0 ; + if (!ipc_timed_sendv(buffer_fd(&a->b), v, n, deadline, stamp)) return 0 ; + } + return 1 ; +} |