#include <fcntl.h>
#include "afb-wsj1.h"
+#include "fdev-systemd.h"
/**************** WebSocket handshake ****************************/
const char *path;
struct addrinfo hint, *rai, *iai;
struct afb_wsj1 *result;
+ struct fdev *fdev;
/* scan the uri */
rc = parse_uri(uri, &host, &service, &path);
if (rc == 0) {
rc = negociate(fd, proto_json1, path, xhost);
if (rc == 0) {
- result = afb_wsj1_create(eloop, fd, itf, closure);
- if (result != NULL) {
- fcntl(fd, F_SETFL, O_NONBLOCK);
- break;
+ fdev = fdev_systemd_create(eloop, fd);
+ if (fdev) {
+ result = afb_wsj1_create(fdev, itf, closure);
+ if (result != NULL) {
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+ break;
+ }
}
}
}
{
int fd;
struct afb_proto_ws *pws;
+ struct fdev *fdev;
fd = get_socket(uri);
if (fd >= 0) {
- pws = afb_proto_ws_create_client(eloop, fd, itf, closure);
- if (pws)
- return pws;
+ fdev = fdev_systemd_create(eloop, fd);
+ if (fdev) {
+ pws = afb_proto_ws_create_client(fdev, itf, closure);
+ if (pws)
+ return pws;
+ }
close(fd);
}
return NULL;
}
-
-