Lines Matching refs:handle
64 static int new_socket(uv_tcp_t* handle, int domain, unsigned int flags) { in new_socket() argument
72 err = uv__stream_open((uv_stream_t*) handle, sockfd, flags); in new_socket()
85 static int maybe_new_socket(uv_tcp_t* handle, int domain, unsigned int flags) { in maybe_new_socket() argument
92 sockfd = uv__stream_fd(handle); in maybe_new_socket()
94 return new_socket(handle, domain, flags); in maybe_new_socket()
99 if (handle->flags & UV_HANDLE_BOUND) in maybe_new_socket()
108 handle->flags |= flags; in maybe_new_socket()
278 uv_tcp_t* handle, in uv__tcp_connect() argument
286 assert(handle->type == UV_TCP); in uv__tcp_connect()
288 if (handle->connect_req != NULL) in uv__tcp_connect()
291 if (handle->delayed_error != 0) in uv__tcp_connect()
294 err = maybe_new_socket(handle, in uv__tcp_connect()
310 r = connect(uv__stream_fd(handle), addr, addrlen); in uv__tcp_connect()
330 handle->delayed_error = UV__ERR(ECONNREFUSED); in uv__tcp_connect()
337 uv__req_init(handle->loop, req, UV_CONNECT); in uv__tcp_connect()
339 req->handle = (uv_stream_t*) handle; in uv__tcp_connect()
341 handle->connect_req = req; in uv__tcp_connect()
343 uv__io_start(handle->loop, &handle->io_watcher, POLLOUT); in uv__tcp_connect()
345 if (handle->delayed_error) in uv__tcp_connect()
346 uv__io_feed(handle->loop, &handle->io_watcher); in uv__tcp_connect()
352 int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) { in uv_tcp_open() argument
355 if (uv__fd_exists(handle->loop, sock)) in uv_tcp_open()
362 return uv__stream_open((uv_stream_t*)handle, in uv_tcp_open()
368 int uv_tcp_getsockname(const uv_tcp_t* handle, in uv_tcp_getsockname() argument
372 if (handle->delayed_error) in uv_tcp_getsockname()
373 return handle->delayed_error; in uv_tcp_getsockname()
375 return uv__getsockpeername((const uv_handle_t*) handle, in uv_tcp_getsockname()
382 int uv_tcp_getpeername(const uv_tcp_t* handle, in uv_tcp_getpeername() argument
386 if (handle->delayed_error) in uv_tcp_getpeername()
387 return handle->delayed_error; in uv_tcp_getpeername()
389 return uv__getsockpeername((const uv_handle_t*) handle, in uv_tcp_getpeername()
396 int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb) { in uv_tcp_close_reset() argument
401 if (uv__is_stream_shutting(handle)) in uv_tcp_close_reset()
404 fd = uv__stream_fd(handle); in uv_tcp_close_reset()
416 uv_close((uv_handle_t*) handle, close_cb); in uv_tcp_close_reset()
580 int uv_tcp_nodelay(uv_tcp_t* handle, int on) { in uv_tcp_nodelay() argument
583 if (uv__stream_fd(handle) != -1) { in uv_tcp_nodelay()
584 err = uv__tcp_nodelay(uv__stream_fd(handle), on); in uv_tcp_nodelay()
590 handle->flags |= UV_HANDLE_TCP_NODELAY; in uv_tcp_nodelay()
592 handle->flags &= ~UV_HANDLE_TCP_NODELAY; in uv_tcp_nodelay()
598 int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) { in uv_tcp_keepalive() argument
601 if (uv__stream_fd(handle) != -1) { in uv_tcp_keepalive()
602 err =uv__tcp_keepalive(uv__stream_fd(handle), on, delay); in uv_tcp_keepalive()
608 handle->flags |= UV_HANDLE_TCP_KEEPALIVE; in uv_tcp_keepalive()
610 handle->flags &= ~UV_HANDLE_TCP_KEEPALIVE; in uv_tcp_keepalive()
620 int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { in uv_tcp_simultaneous_accepts() argument
625 void uv__tcp_close(uv_tcp_t* handle) { in uv__tcp_close() argument
626 uv__stream_close((uv_stream_t*)handle); in uv__tcp_close()