diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-08-01 19:36:38 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-08-01 19:36:38 +0000 |
commit | 69099d84949a8044fdfc74e9d7ff6b9e57fc0bcd (patch) | |
tree | 9c97923869ff4f56717d7e0ac97c8588f816c798 /src/libwpactrl/wpactrl_start.c | |
parent | 22a1dc61ef8e4e1c98e3a088db1dbc84d424c7a7 (diff) | |
download | bcnm-69099d84949a8044fdfc74e9d7ff6b9e57fc0bcd.tar.xz |
Flesh out libwpactrl
Diffstat (limited to 'src/libwpactrl/wpactrl_start.c')
-rw-r--r-- | src/libwpactrl/wpactrl_start.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libwpactrl/wpactrl_start.c b/src/libwpactrl/wpactrl_start.c index 86a266b..80018d5 100644 --- a/src/libwpactrl/wpactrl_start.c +++ b/src/libwpactrl/wpactrl_start.c @@ -8,24 +8,29 @@ #include <bcnm/wpactrl.h> #include "wpactrl-internal.h" -int wpactrl_start (wpactrl_t *a, char const *path, tain_t const *deadline, tain_t *stamp) +int wpactrl_start (wpactrl_t *a, char const *path, unsigned int timeout, tain_t *stamp) { + tain_t tto, deadline ; int fda, fds ; + if (timeout) tain_from_millisecs(&tto, timeout) ; + else tto = tain_infinite_relative ; fds = ipc_datagram_nbcoe() ; if (fds < 0) goto err ; - if (!ipc_timed_connect(fds, path, deadline, stamp)) goto errs ; + tain_add(&deadline, &tto, stamp) ; + if (!ipc_timed_connect(fds, path, &deadline, stamp)) goto errs ; fda = ipc_datagram_nbcoe() ; if (fda < 0) goto errs ; - if (!ipc_timed_connect(fda, path, deadline, stamp)) goto erra ; - if (!ipc_timed_send(fda, "ATTACH", 6, deadline, stamp)) goto erra ; + if (!ipc_timed_connect(fda, path, &deadline, stamp)) goto erra ; + if (!ipc_timed_send(fda, "ATTACH", 6, &deadline, stamp)) goto erra ; { ssize_t r ; char answer[3] ; - r = wpactrl_fd_timed_recv(fda, answer, 3, deadline, stamp) ; + r = wpactrl_fd_timed_recv(fda, answer, 3, &deadline, stamp) ; if (r != 3 || memcmp(answer, "OK\n", 3)) goto erra ; } a->fds = fds ; a->fda = fda ; + a->tto = tto ; return 1 ; erra: |