Lines Matching defs:handle
64 static int new_socket(uv_tcp_t* handle, int domain, unsigned int flags) {
72 err = uv__stream_open((uv_stream_t*) handle, sockfd, flags);
85 static int maybe_new_socket(uv_tcp_t* handle, int domain, unsigned int flags) {
92 sockfd = uv__stream_fd(handle);
94 return new_socket(handle, domain, flags);
99 if (handle->flags & UV_HANDLE_BOUND)
108 handle->flags |= flags;
127 /* If anything fails beyond this point we need to remove the handle from
128 * the handle queue, since it was added by uv__handle_init in uv_stream_init.
272 uv_tcp_t* handle,
280 assert(handle->type == UV_TCP);
282 if (handle->connect_req != NULL)
285 if (handle->delayed_error != 0)
288 err = maybe_new_socket(handle,
304 r = connect(uv__stream_fd(handle), addr, addrlen);
324 handle->delayed_error = UV__ERR(ECONNREFUSED);
331 uv__req_init(handle->loop, req, UV_CONNECT);
333 req->handle = (uv_stream_t*) handle;
335 handle->connect_req = req;
337 uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
339 if (handle->delayed_error)
340 uv__io_feed(handle->loop, &handle->io_watcher);
346 int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) {
349 if (uv__fd_exists(handle->loop, sock))
356 return uv__stream_open((uv_stream_t*)handle,
362 int uv_tcp_getsockname(const uv_tcp_t* handle,
366 if (handle->delayed_error)
367 return handle->delayed_error;
369 return uv__getsockpeername((const uv_handle_t*) handle,
376 int uv_tcp_getpeername(const uv_tcp_t* handle,
380 if (handle->delayed_error)
381 return handle->delayed_error;
383 return uv__getsockpeername((const uv_handle_t*) handle,
390 int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb) {
395 if (uv__is_stream_shutting(handle))
398 fd = uv__stream_fd(handle);
410 uv_close((uv_handle_t*) handle, close_cb);
562 int uv_tcp_nodelay(uv_tcp_t* handle, int on) {
565 if (uv__stream_fd(handle) != -1) {
566 err = uv__tcp_nodelay(uv__stream_fd(handle), on);
572 handle->flags |= UV_HANDLE_TCP_NODELAY;
574 handle->flags &= ~UV_HANDLE_TCP_NODELAY;
580 int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) {
583 if (uv__stream_fd(handle) != -1) {
584 err =uv__tcp_keepalive(uv__stream_fd(handle), on, delay);
590 handle->flags |= UV_HANDLE_TCP_KEEPALIVE;
592 handle->flags &= ~UV_HANDLE_TCP_KEEPALIVE;
594 /* TODO Store delay if uv__stream_fd(handle) == -1 but don't want to enlarge
602 int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
607 void uv__tcp_close(uv_tcp_t* handle) {
608 uv__stream_close((uv_stream_t*)handle);