Lines Matching refs:tcp
113 int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* tcp, unsigned int flags) { in uv_tcp_init_ex() argument
125 uv__stream_init(loop, (uv_stream_t*)tcp, UV_TCP); in uv_tcp_init_ex()
132 err = new_socket(tcp, domain, 0); in uv_tcp_init_ex()
134 uv__queue_remove(&tcp->handle_queue); in uv_tcp_init_ex()
135 if (tcp->io_watcher.fd != -1) in uv_tcp_init_ex()
136 uv__close(tcp->io_watcher.fd); in uv_tcp_init_ex()
137 tcp->io_watcher.fd = -1; in uv_tcp_init_ex()
146 int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* tcp) { in uv_tcp_init() argument
147 return uv_tcp_init_ex(loop, tcp, AF_UNSPEC); in uv_tcp_init()
151 int uv__tcp_bind(uv_tcp_t* tcp, in uv__tcp_bind() argument
162 err = maybe_new_socket(tcp, addr->sa_family, 0); in uv__tcp_bind()
167 if (setsockopt(tcp->io_watcher.fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) in uv__tcp_bind()
171 err = uv__sock_reuseport(tcp->io_watcher.fd); in uv__tcp_bind()
180 if (setsockopt(tcp->io_watcher.fd, in uv__tcp_bind()
196 err = bind(tcp->io_watcher.fd, addr, addrlen); in uv__tcp_bind()
204 tcp->delayed_error = (err == -1) ? UV__ERR(errno) : 0; in uv__tcp_bind()
206 tcp->flags |= UV_HANDLE_BOUND; in uv__tcp_bind()
208 tcp->flags |= UV_HANDLE_IPV6; in uv__tcp_bind()
421 int uv__tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) { in uv__tcp_listen() argument
425 if (tcp->delayed_error) in uv__tcp_listen()
426 return tcp->delayed_error; in uv__tcp_listen()
436 err = maybe_new_socket(tcp, AF_INET, flags); in uv__tcp_listen()
440 if (listen(tcp->io_watcher.fd, backlog)) in uv__tcp_listen()
443 tcp->connection_cb = cb; in uv__tcp_listen()
444 tcp->flags |= UV_HANDLE_BOUND; in uv__tcp_listen()
447 tcp->io_watcher.cb = uv__server_io; in uv__tcp_listen()
448 uv__io_start(tcp->loop, &tcp->io_watcher, POLLIN); in uv__tcp_listen()