summaryrefslogtreecommitdiff
path: root/src/libs6rc/s6rc_connection_start.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-30 13:08:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-30 13:08:04 +0000
commitba3bcbb86ea0177349bcd021559347248d6ab10a (patch)
tree23d8be4d59a1639ebea301fb2caf39b8b1ed0e27 /src/libs6rc/s6rc_connection_start.c
parent79cb9644f99f056641f4c145da6e7ca63b333b80 (diff)
downloads6-rc-ba3bcbb86ea0177349bcd021559347248d6ab10a.tar.xz
Stash temporary changes. Does not build; is not intended to.
Diffstat (limited to 'src/libs6rc/s6rc_connection_start.c')
-rw-r--r--src/libs6rc/s6rc_connection_start.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libs6rc/s6rc_connection_start.c b/src/libs6rc/s6rc_connection_start.c
new file mode 100644
index 0000000..33b2b1a
--- /dev/null
+++ b/src/libs6rc/s6rc_connection_start.c
@@ -0,0 +1,22 @@
+/* ISC license. */
+
+#include <skalibs/djbunix.h>
+#include <skalibs/webipc.h>
+#include <skalibs/textmessage.h>
+
+#include <s6-rc/connection-common.h>
+#include <s6-rc/connection.h>
+
+int s6rc_connection_start (s6rc_connection_t *a, char const *path, tain_t const *deadline, tain_t *stamp)
+{
+ int fd = ipc_stream_nbcoe() ;
+ if (fd < 0) return 0 ;
+ if (!ipc_timed_connect(fd, path, deadline, stamp))
+ {
+ fd_close(fd) ;
+ return 0 ;
+ }
+ textmessage_sender_init(&a->out, fd) ;
+ textmessage_receiver_init(&a->in, fd, a->inbuf, S6RC_CONNECTION_BUFSIZE, TEXTMESSAGE_MAXLEN) ;
+ return 1 ;
+}