Exemplo n.º 1
0
static inline void
_server_event_read(struct buf_sock *s)
{
    struct tcp_conn *c = s->ch;

    ASSERT(c->level == CHANNEL_META);

    while (_tcp_accept(s));
}
Exemplo n.º 2
0
static void
_admin_event_read(struct buf_sock *s)
{
    struct tcp_conn *c = s->ch;

    if (c->level == CHANNEL_META) {
        _tcp_accept(s);
    } else if (c->level == CHANNEL_BASE) {
        _admin_read(s);
        _admin_post_read(s);
    } else {
        NOT_REACHED();
    }
}
Exemplo n.º 3
0
#define DEBUG 0

static int _tcp_accept(int sock, struct sockaddr *_RESTRICT address,
	socklen_t *_RESTRICT address_len);

static int _uds_accept(int sock, struct sockaddr *_RESTRICT address,
	socklen_t *_RESTRICT address_len);

int accept(int sock, struct sockaddr *_RESTRICT address,
	socklen_t *_RESTRICT address_len)
{
	int r;
	nwio_udpopt_t udpopt;

	r= _tcp_accept(sock, address, address_len);
	if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
		return r;

	r= _uds_accept(sock, address, address_len);
	if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
		return r;

	/* Unfortunately, we have to return EOPNOTSUPP for a socket that
	 * does not support accept (such as a UDP socket) and ENOTSOCK for
	 * filedescriptors that do not refer to a socket.
	 */
	r= ioctl(sock, NWIOGUDPOPT, &udpopt);
	if (r == 0)
	{
		/* UDP socket */
Exemplo n.º 4
0
static void tls_accept(uv_stream_t *master, int status)
{
	_tcp_accept(master, status, true);
}
Exemplo n.º 5
0
static void tcp_accept(uv_stream_t *master, int status)
{
	_tcp_accept(master, status, false);
}