Commit 5a68ec40 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: add vlc_accept_i11e() for the sake of completeness

parent a117a662
......@@ -103,6 +103,8 @@ ssize_t vlc_send_i11e(int fd, const void *buf, size_t len, int flags)
return vlc_sendto_i11e(fd, buf, len, flags, NULL, 0);
}
VLC_API int vlc_accept_i11e(int fd, struct sockaddr *, socklen_t *, bool);
/**
* @}
* @defgroup interrupt_context Interrupt context signaling and manipulation
......
......@@ -548,6 +548,7 @@ vlc_recvmsg_i11e
vlc_recvfrom_i11e
vlc_sendmsg_i11e
vlc_sendto_i11e
vlc_accept_i11e
vlc_sem_wait_i11e
vlc_interrupt_create
vlc_interrupt_destroy
......
......@@ -38,6 +38,7 @@
#include <vlc_common.h>
#include <vlc_fs.h> /* vlc_pipe */
#include <vlc_network.h> /* vlc_accept */
#include "interrupt.h"
#include "libvlc.h"
......@@ -489,6 +490,20 @@ ssize_t vlc_sendto_i11e(int fd, const void *buf, size_t len, int flags,
return vlc_sendmsg_i11e(fd, &msg, flags);
}
int vlc_accept_i11e(int fd, struct sockaddr *addr, socklen_t *addrlen,
bool blocking)
{
struct pollfd ufd;
ufd.fd = fd;
ufd.events = POLLIN;
if (vlc_poll_i11e(&ufd, 1, -1) < 0)
return -1;
return vlc_accept(fd, addr, addrlen, blocking);
}
#else /* _WIN32 */
static void CALLBACK vlc_poll_i11e_wake_self(ULONG_PTR data)
......@@ -620,4 +635,21 @@ ssize_t vlc_sendto_i11e(int fd, const void *buf, size_t len, int flags,
return ret;
}
int vlc_accept_i11e(int fd, struct sockaddr *addr, socklen_t *addrlen,
bool blocking)
{
struct pollfd ufd;
ufd.fd = fd;
ufd.events = POLLIN;
if (vlc_poll_i11e(&ufd, 1, -1) < 0)
return -1;
int cfd = vlc_accept(fd, addr, addrlen, blocking);
if (cfd < 0 && WSAGetLastError() == WSAEWOULDBLOCK)
errno = EAGAIN;
return cfd;
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment