Lines Matching refs:handle
40 static int uv__tcp_nodelay(uv_tcp_t* handle, SOCKET socket, int enable) { in uv__tcp_nodelay() argument
52 static int uv__tcp_keepalive(uv_tcp_t* handle, SOCKET socket, int enable, unsigned int delay) { in uv__tcp_keepalive() argument
80 uv_tcp_t* handle, in uv__tcp_set_socket() argument
88 if (handle->socket != INVALID_SOCKET) in uv__tcp_set_socket()
107 handle->flags |= UV_HANDLE_EMULATE_IOCP; in uv__tcp_set_socket()
119 if (!(handle->flags & UV_HANDLE_EMULATE_IOCP) && !non_ifs_lsp) { in uv__tcp_set_socket()
124 handle->flags |= UV_HANDLE_SYNC_BYPASS_IOCP; in uv__tcp_set_socket()
127 if (handle->flags & UV_HANDLE_TCP_NODELAY) { in uv__tcp_set_socket()
128 err = uv__tcp_nodelay(handle, socket, 1); in uv__tcp_set_socket()
134 if (handle->flags & UV_HANDLE_TCP_KEEPALIVE) { in uv__tcp_set_socket()
135 err = uv__tcp_keepalive(handle, socket, 1, 60); in uv__tcp_set_socket()
140 handle->socket = socket; in uv__tcp_set_socket()
143 handle->flags |= UV_HANDLE_IPV6; in uv__tcp_set_socket()
145 assert(!(handle->flags & UV_HANDLE_IPV6)); in uv__tcp_set_socket()
152 int uv_tcp_init_ex(uv_loop_t* loop, uv_tcp_t* handle, unsigned int flags) { in uv_tcp_init_ex() argument
163 uv__stream_init(loop, (uv_stream_t*) handle, UV_TCP); in uv_tcp_init_ex()
164 handle->tcp.serv.accept_reqs = NULL; in uv_tcp_init_ex()
165 handle->tcp.serv.pending_accepts = NULL; in uv_tcp_init_ex()
166 handle->socket = INVALID_SOCKET; in uv_tcp_init_ex()
167 handle->reqs_pending = 0; in uv_tcp_init_ex()
168 handle->tcp.serv.func_acceptex = NULL; in uv_tcp_init_ex()
169 handle->tcp.conn.func_connectex = NULL; in uv_tcp_init_ex()
170 handle->tcp.serv.processed_accepts = 0; in uv_tcp_init_ex()
171 handle->delayed_error = 0; in uv_tcp_init_ex()
184 uv__queue_remove(&handle->handle_queue); in uv_tcp_init_ex()
188 err = uv__tcp_set_socket(handle->loop, handle, sock, domain, 0); in uv_tcp_init_ex()
191 uv__queue_remove(&handle->handle_queue); in uv_tcp_init_ex()
201 int uv_tcp_init(uv_loop_t* loop, uv_tcp_t* handle) { in uv_tcp_init() argument
202 return uv_tcp_init_ex(loop, handle, AF_UNSPEC); in uv_tcp_init()
233 void uv__tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) { in uv__tcp_endgame() argument
237 assert(handle->flags & UV_HANDLE_CLOSING); in uv__tcp_endgame()
238 assert(handle->reqs_pending == 0); in uv__tcp_endgame()
239 assert(!(handle->flags & UV_HANDLE_CLOSED)); in uv__tcp_endgame()
240 assert(handle->socket == INVALID_SOCKET); in uv__tcp_endgame()
242 if (!(handle->flags & UV_HANDLE_CONNECTION) && handle->tcp.serv.accept_reqs) { in uv__tcp_endgame()
243 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_endgame()
245 req = &handle->tcp.serv.accept_reqs[i]; in uv__tcp_endgame()
257 uv__free(handle->tcp.serv.accept_reqs); in uv__tcp_endgame()
258 handle->tcp.serv.accept_reqs = NULL; in uv__tcp_endgame()
261 if (handle->flags & UV_HANDLE_CONNECTION && in uv__tcp_endgame()
262 handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_endgame()
263 if (handle->read_req.wait_handle != INVALID_HANDLE_VALUE) { in uv__tcp_endgame()
264 UnregisterWait(handle->read_req.wait_handle); in uv__tcp_endgame()
265 handle->read_req.wait_handle = INVALID_HANDLE_VALUE; in uv__tcp_endgame()
267 if (handle->read_req.event_handle != NULL) { in uv__tcp_endgame()
268 CloseHandle(handle->read_req.event_handle); in uv__tcp_endgame()
269 handle->read_req.event_handle = NULL; in uv__tcp_endgame()
273 uv__handle_close(handle); in uv__tcp_endgame()
288 static int uv__tcp_try_bind(uv_tcp_t* handle, in uv__tcp_try_bind() argument
301 if (handle->socket == INVALID_SOCKET) { in uv__tcp_try_bind()
313 err = uv__tcp_set_socket(handle->loop, handle, sock, addr->sa_family, 0); in uv__tcp_try_bind()
329 setsockopt(handle->socket, in uv__tcp_try_bind()
337 r = bind(handle->socket, addr, addrlen); in uv__tcp_try_bind()
343 handle->delayed_error = err; in uv__tcp_try_bind()
349 handle->flags |= UV_HANDLE_BOUND; in uv__tcp_try_bind()
357 uv_tcp_t* handle; in post_completion() local
361 handle = (uv_tcp_t*)req->data; in post_completion()
362 assert(handle != NULL); in post_completion()
365 if (!PostQueuedCompletionStatus(handle->loop->iocp, in post_completion()
376 uv_tcp_t* handle; in post_write_completion() local
380 handle = (uv_tcp_t*)req->handle; in post_write_completion()
381 assert(handle != NULL); in post_write_completion()
384 if (!PostQueuedCompletionStatus(handle->loop->iocp, in post_write_completion()
393 static void uv__tcp_queue_accept(uv_tcp_t* handle, uv_tcp_accept_t* req) { in uv__tcp_queue_accept() argument
394 uv_loop_t* loop = handle->loop; in uv__tcp_queue_accept()
400 assert(handle->flags & UV_HANDLE_LISTENING); in uv__tcp_queue_accept()
404 if (handle->flags & UV_HANDLE_IPV6) { in uv__tcp_queue_accept()
415 handle->reqs_pending++; in uv__tcp_queue_accept()
423 handle->reqs_pending++; in uv__tcp_queue_accept()
430 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_queue_accept()
435 success = handle->tcp.serv.func_acceptex(handle->socket, in uv__tcp_queue_accept()
447 handle->reqs_pending++; in uv__tcp_queue_accept()
452 handle->reqs_pending++; in uv__tcp_queue_accept()
453 if (handle->flags & UV_HANDLE_EMULATE_IOCP && in uv__tcp_queue_accept()
465 handle->reqs_pending++; in uv__tcp_queue_accept()
469 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_queue_accept()
477 static void uv__tcp_queue_read(uv_loop_t* loop, uv_tcp_t* handle) { in uv__tcp_queue_read() argument
483 assert(handle->flags & UV_HANDLE_READING); in uv__tcp_queue_read()
484 assert(!(handle->flags & UV_HANDLE_READ_PENDING)); in uv__tcp_queue_read()
486 req = &handle->read_req; in uv__tcp_queue_read()
489 handle->flags |= UV_HANDLE_ZERO_READ; in uv__tcp_queue_read()
495 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_queue_read()
501 result = WSARecv(handle->socket, in uv__tcp_queue_read()
509 handle->flags |= UV_HANDLE_READ_PENDING; in uv__tcp_queue_read()
510 handle->reqs_pending++; in uv__tcp_queue_read()
518 if (handle->flags & UV_HANDLE_EMULATE_IOCP && in uv__tcp_queue_read()
534 int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb) { in uv_tcp_close_reset() argument
538 if (uv__is_stream_shutting(handle)) in uv_tcp_close_reset()
541 if (0 != setsockopt(handle->socket, SOL_SOCKET, SO_LINGER, (const char*)&l, sizeof(l))) in uv_tcp_close_reset()
544 uv_close((uv_handle_t*) handle, close_cb); in uv_tcp_close_reset()
549 int uv__tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) { in uv__tcp_listen() argument
556 if (handle->flags & UV_HANDLE_LISTENING) { in uv__tcp_listen()
557 handle->stream.serv.connection_cb = cb; in uv__tcp_listen()
560 if (handle->flags & UV_HANDLE_READING) { in uv__tcp_listen()
564 if (handle->delayed_error) { in uv__tcp_listen()
565 return handle->delayed_error; in uv__tcp_listen()
568 if (!(handle->flags & UV_HANDLE_BOUND)) { in uv__tcp_listen()
569 err = uv__tcp_try_bind(handle, in uv__tcp_listen()
575 if (handle->delayed_error) in uv__tcp_listen()
576 return handle->delayed_error; in uv__tcp_listen()
579 if (!handle->tcp.serv.func_acceptex) { in uv__tcp_listen()
580 if (!uv__get_acceptex_function(handle->socket, &handle->tcp.serv.func_acceptex)) { in uv__tcp_listen()
586 if (!(handle->flags & UV_HANDLE_SHARED_TCP_SOCKET) && in uv__tcp_listen()
587 listen(handle->socket, backlog) == SOCKET_ERROR) { in uv__tcp_listen()
591 handle->flags |= UV_HANDLE_LISTENING; in uv__tcp_listen()
592 handle->stream.serv.connection_cb = cb; in uv__tcp_listen()
593 INCREASE_ACTIVE_COUNT(loop, handle); in uv__tcp_listen()
595 simultaneous_accepts = handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT ? 1 in uv__tcp_listen()
598 if (handle->tcp.serv.accept_reqs == NULL) { in uv__tcp_listen()
599 handle->tcp.serv.accept_reqs = in uv__tcp_listen()
601 if (!handle->tcp.serv.accept_reqs) { in uv__tcp_listen()
606 req = &handle->tcp.serv.accept_reqs[i]; in uv__tcp_listen()
609 req->data = handle; in uv__tcp_listen()
612 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_listen()
621 uv__tcp_queue_accept(handle, req); in uv__tcp_listen()
628 req = &handle->tcp.serv.accept_reqs[i]; in uv__tcp_listen()
631 req->data = handle; in uv__tcp_listen()
707 int uv__tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb, in uv__tcp_read_start() argument
709 uv_loop_t* loop = handle->loop; in uv__tcp_read_start()
711 handle->flags |= UV_HANDLE_READING; in uv__tcp_read_start()
712 handle->read_cb = read_cb; in uv__tcp_read_start()
713 handle->alloc_cb = alloc_cb; in uv__tcp_read_start()
714 INCREASE_ACTIVE_COUNT(loop, handle); in uv__tcp_read_start()
718 if (!(handle->flags & UV_HANDLE_READ_PENDING)) { in uv__tcp_read_start()
719 if (handle->flags & UV_HANDLE_EMULATE_IOCP && in uv__tcp_read_start()
720 handle->read_req.event_handle == NULL) { in uv__tcp_read_start()
721 handle->read_req.event_handle = CreateEvent(NULL, 0, 0, NULL); in uv__tcp_read_start()
722 if (handle->read_req.event_handle == NULL) { in uv__tcp_read_start()
726 uv__tcp_queue_read(loop, handle); in uv__tcp_read_start()
768 uv_tcp_t* handle, in uv__tcp_try_connect() argument
772 uv_loop_t* loop = handle->loop; in uv__tcp_try_connect()
784 if (handle->delayed_error != 0) in uv__tcp_try_connect()
787 if (!(handle->flags & UV_HANDLE_BOUND)) { in uv__tcp_try_connect()
795 err = uv__tcp_try_bind(handle, bind_addr, addrlen, 0); in uv__tcp_try_connect()
798 if (handle->delayed_error != 0) in uv__tcp_try_connect()
802 if (!handle->tcp.conn.func_connectex) { in uv__tcp_try_connect()
803 if (!uv__get_connectex_function(handle->socket, &handle->tcp.conn.func_connectex)) { in uv__tcp_try_connect()
816 WSAIoctl(handle->socket, in uv__tcp_try_connect()
830 req->handle = (uv_stream_t*) handle; in uv__tcp_try_connect()
834 if (handle->delayed_error != 0) { in uv__tcp_try_connect()
836 handle->reqs_pending++; in uv__tcp_try_connect()
837 REGISTER_HANDLE_REQ(loop, handle); in uv__tcp_try_connect()
842 success = handle->tcp.conn.func_connectex(handle->socket, in uv__tcp_try_connect()
852 handle->reqs_pending++; in uv__tcp_try_connect()
853 REGISTER_HANDLE_REQ(loop, handle); in uv__tcp_try_connect()
857 handle->reqs_pending++; in uv__tcp_try_connect()
858 REGISTER_HANDLE_REQ(loop, handle); in uv__tcp_try_connect()
867 int uv_tcp_getsockname(const uv_tcp_t* handle, in uv_tcp_getsockname() argument
871 return uv__getsockpeername((const uv_handle_t*) handle, in uv_tcp_getsockname()
875 handle->delayed_error); in uv_tcp_getsockname()
879 int uv_tcp_getpeername(const uv_tcp_t* handle, in uv_tcp_getpeername() argument
883 return uv__getsockpeername((const uv_handle_t*) handle, in uv_tcp_getpeername()
887 handle->delayed_error); in uv_tcp_getpeername()
893 uv_tcp_t* handle, in uv__tcp_write() argument
901 req->handle = (uv_stream_t*) handle; in uv__tcp_write()
906 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__tcp_write()
915 result = WSASend(handle->socket, in uv__tcp_write()
926 handle->reqs_pending++; in uv__tcp_write()
927 handle->stream.conn.write_reqs_pending++; in uv__tcp_write()
928 REGISTER_HANDLE_REQ(loop, handle); in uv__tcp_write()
933 handle->reqs_pending++; in uv__tcp_write()
934 handle->stream.conn.write_reqs_pending++; in uv__tcp_write()
935 REGISTER_HANDLE_REQ(loop, handle); in uv__tcp_write()
936 handle->write_queue_size += req->u.io.queued_bytes; in uv__tcp_write()
937 if (handle->flags & UV_HANDLE_EMULATE_IOCP && in uv__tcp_write()
947 handle->reqs_pending++; in uv__tcp_write()
948 handle->stream.conn.write_reqs_pending++; in uv__tcp_write()
949 REGISTER_HANDLE_REQ(loop, handle); in uv__tcp_write()
958 int uv__tcp_try_write(uv_tcp_t* handle, in uv__tcp_try_write() argument
964 if (handle->stream.conn.write_reqs_pending > 0) in uv__tcp_try_write()
967 result = WSASend(handle->socket, in uv__tcp_try_write()
982 void uv__process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, in uv__process_tcp_read_req() argument
988 assert(handle->type == UV_TCP); in uv__process_tcp_read_req()
990 handle->flags &= ~UV_HANDLE_READ_PENDING; in uv__process_tcp_read_req()
994 if ((handle->flags & UV_HANDLE_READING) || in uv__process_tcp_read_req()
995 !(handle->flags & UV_HANDLE_ZERO_READ)) { in uv__process_tcp_read_req()
996 handle->flags &= ~UV_HANDLE_READING; in uv__process_tcp_read_req()
997 DECREASE_ACTIVE_COUNT(loop, handle); in uv__process_tcp_read_req()
998 buf = (handle->flags & UV_HANDLE_ZERO_READ) ? in uv__process_tcp_read_req()
999 uv_buf_init(NULL, 0) : handle->tcp.conn.read_buffer; in uv__process_tcp_read_req()
1008 handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); in uv__process_tcp_read_req()
1010 handle->read_cb((uv_stream_t*)handle, in uv__process_tcp_read_req()
1015 if (!(handle->flags & UV_HANDLE_ZERO_READ)) { in uv__process_tcp_read_req()
1019 handle->read_cb((uv_stream_t*)handle, in uv__process_tcp_read_req()
1021 &handle->tcp.conn.read_buffer); in uv__process_tcp_read_req()
1023 if (req->u.io.overlapped.InternalHigh < handle->tcp.conn.read_buffer.len) { in uv__process_tcp_read_req()
1028 if (handle->flags & UV_HANDLE_READING) { in uv__process_tcp_read_req()
1029 handle->flags &= ~UV_HANDLE_READING; in uv__process_tcp_read_req()
1030 DECREASE_ACTIVE_COUNT(loop, handle); in uv__process_tcp_read_req()
1035 handle->read_cb((uv_stream_t*)handle, UV_EOF, &handle->tcp.conn.read_buffer); in uv__process_tcp_read_req()
1042 while ((handle->flags & UV_HANDLE_READING) && (count-- > 0)) { in uv__process_tcp_read_req()
1044 handle->alloc_cb((uv_handle_t*) handle, 65536, &buf); in uv__process_tcp_read_req()
1046 handle->read_cb((uv_stream_t*) handle, UV_ENOBUFS, &buf); in uv__process_tcp_read_req()
1052 if (WSARecv(handle->socket, in uv__process_tcp_read_req()
1061 handle->read_cb((uv_stream_t*)handle, bytes, &buf); in uv__process_tcp_read_req()
1068 handle->flags &= ~UV_HANDLE_READING; in uv__process_tcp_read_req()
1069 DECREASE_ACTIVE_COUNT(loop, handle); in uv__process_tcp_read_req()
1071 handle->read_cb((uv_stream_t*)handle, UV_EOF, &buf); in uv__process_tcp_read_req()
1078 handle->read_cb((uv_stream_t*)handle, 0, &buf); in uv__process_tcp_read_req()
1081 handle->flags &= ~UV_HANDLE_READING; in uv__process_tcp_read_req()
1082 DECREASE_ACTIVE_COUNT(loop, handle); in uv__process_tcp_read_req()
1089 handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); in uv__process_tcp_read_req()
1091 handle->read_cb((uv_stream_t*)handle, in uv__process_tcp_read_req()
1101 if ((handle->flags & UV_HANDLE_READING) && in uv__process_tcp_read_req()
1102 !(handle->flags & UV_HANDLE_READ_PENDING)) { in uv__process_tcp_read_req()
1103 uv__tcp_queue_read(loop, handle); in uv__process_tcp_read_req()
1107 DECREASE_PENDING_REQ_COUNT(handle); in uv__process_tcp_read_req()
1111 void uv__process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle, in uv__process_tcp_write_req() argument
1115 assert(handle->type == UV_TCP); in uv__process_tcp_write_req()
1117 assert(handle->write_queue_size >= req->u.io.queued_bytes); in uv__process_tcp_write_req()
1118 handle->write_queue_size -= req->u.io.queued_bytes; in uv__process_tcp_write_req()
1120 UNREGISTER_HANDLE_REQ(loop, handle); in uv__process_tcp_write_req()
1122 if (handle->flags & UV_HANDLE_EMULATE_IOCP) { in uv__process_tcp_write_req()
1142 handle->stream.conn.write_reqs_pending--; in uv__process_tcp_write_req()
1143 if (handle->stream.conn.write_reqs_pending == 0) { in uv__process_tcp_write_req()
1144 if (handle->flags & UV_HANDLE_CLOSING) { in uv__process_tcp_write_req()
1145 closesocket(handle->socket); in uv__process_tcp_write_req()
1146 handle->socket = INVALID_SOCKET; in uv__process_tcp_write_req()
1148 if (uv__is_stream_shutting(handle)) in uv__process_tcp_write_req()
1150 handle, in uv__process_tcp_write_req()
1151 handle->stream.conn.shutdown_req); in uv__process_tcp_write_req()
1154 DECREASE_PENDING_REQ_COUNT(handle); in uv__process_tcp_write_req()
1158 void uv__process_tcp_accept_req(uv_loop_t* loop, uv_tcp_t* handle, in uv__process_tcp_accept_req() argument
1163 assert(handle->type == UV_TCP); in uv__process_tcp_accept_req()
1169 if (handle->flags & UV_HANDLE_LISTENING) { in uv__process_tcp_accept_req()
1170 handle->flags &= ~UV_HANDLE_LISTENING; in uv__process_tcp_accept_req()
1171 DECREASE_ACTIVE_COUNT(loop, handle); in uv__process_tcp_accept_req()
1172 if (handle->stream.serv.connection_cb) { in uv__process_tcp_accept_req()
1174 handle->stream.serv.connection_cb((uv_stream_t*)handle, in uv__process_tcp_accept_req()
1182 (char*)&handle->socket, in uv__process_tcp_accept_req()
1183 sizeof(handle->socket)) == 0) { in uv__process_tcp_accept_req()
1184 req->next_pending = handle->tcp.serv.pending_accepts; in uv__process_tcp_accept_req()
1185 handle->tcp.serv.pending_accepts = req; in uv__process_tcp_accept_req()
1188 if (handle->stream.serv.connection_cb) { in uv__process_tcp_accept_req()
1189 handle->stream.serv.connection_cb((uv_stream_t*)handle, 0); in uv__process_tcp_accept_req()
1197 if (handle->flags & UV_HANDLE_LISTENING) { in uv__process_tcp_accept_req()
1198 uv__tcp_queue_accept(handle, req); in uv__process_tcp_accept_req()
1202 DECREASE_PENDING_REQ_COUNT(handle); in uv__process_tcp_accept_req()
1206 void uv__process_tcp_connect_req(uv_loop_t* loop, uv_tcp_t* handle, in uv__process_tcp_connect_req() argument
1210 assert(handle->type == UV_TCP); in uv__process_tcp_connect_req()
1212 UNREGISTER_HANDLE_REQ(loop, handle); in uv__process_tcp_connect_req()
1215 if (handle->delayed_error) { in uv__process_tcp_connect_req()
1220 err = handle->delayed_error; in uv__process_tcp_connect_req()
1221 handle->delayed_error = 0; in uv__process_tcp_connect_req()
1223 if (handle->flags & UV_HANDLE_CLOSING) { in uv__process_tcp_connect_req()
1226 } else if (setsockopt(handle->socket, in uv__process_tcp_connect_req()
1231 uv__connection_init((uv_stream_t*)handle); in uv__process_tcp_connect_req()
1232 handle->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; in uv__process_tcp_connect_req()
1241 DECREASE_PENDING_REQ_COUNT(handle); in uv__process_tcp_connect_req()
1245 int uv__tcp_xfer_export(uv_tcp_t* handle, in uv__tcp_xfer_export() argument
1249 if (handle->flags & UV_HANDLE_CONNECTION) { in uv__tcp_xfer_export()
1257 if (!(handle->flags & UV_HANDLE_LISTENING)) { in uv__tcp_xfer_export()
1258 if (!(handle->flags & UV_HANDLE_BOUND)) { in uv__tcp_xfer_export()
1261 if (handle->delayed_error == 0 && in uv__tcp_xfer_export()
1262 listen(handle->socket, SOMAXCONN) == SOCKET_ERROR) { in uv__tcp_xfer_export()
1263 handle->delayed_error = WSAGetLastError(); in uv__tcp_xfer_export()
1268 if (WSADuplicateSocketW(handle->socket, target_pid, &xfer_info->socket_info)) in uv__tcp_xfer_export()
1270 xfer_info->delayed_error = handle->delayed_error; in uv__tcp_xfer_export()
1274 handle->flags |= UV_HANDLE_SHARED_TCP_SOCKET; in uv__tcp_xfer_export()
1319 int uv_tcp_nodelay(uv_tcp_t* handle, int enable) { in uv_tcp_nodelay() argument
1322 if (handle->socket != INVALID_SOCKET) { in uv_tcp_nodelay()
1323 err = uv__tcp_nodelay(handle, handle->socket, enable); in uv_tcp_nodelay()
1329 handle->flags |= UV_HANDLE_TCP_NODELAY; in uv_tcp_nodelay()
1331 handle->flags &= ~UV_HANDLE_TCP_NODELAY; in uv_tcp_nodelay()
1338 int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay) { in uv_tcp_keepalive() argument
1341 if (handle->socket != INVALID_SOCKET) { in uv_tcp_keepalive()
1342 err = uv__tcp_keepalive(handle, handle->socket, enable, delay); in uv_tcp_keepalive()
1348 handle->flags |= UV_HANDLE_TCP_KEEPALIVE; in uv_tcp_keepalive()
1350 handle->flags &= ~UV_HANDLE_TCP_KEEPALIVE; in uv_tcp_keepalive()
1359 int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) { in uv_tcp_simultaneous_accepts() argument
1360 if (handle->flags & UV_HANDLE_CONNECTION) { in uv_tcp_simultaneous_accepts()
1365 if ((enable && !(handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT)) || in uv_tcp_simultaneous_accepts()
1366 (!enable && handle->flags & UV_HANDLE_TCP_SINGLE_ACCEPT)) { in uv_tcp_simultaneous_accepts()
1376 if (handle->flags & UV_HANDLE_TCP_ACCEPT_STATE_CHANGING) { in uv_tcp_simultaneous_accepts()
1380 handle->flags |= UV_HANDLE_TCP_SINGLE_ACCEPT; in uv_tcp_simultaneous_accepts()
1383 if (handle->flags & UV_HANDLE_LISTENING) { in uv_tcp_simultaneous_accepts()
1384 handle->flags |= UV_HANDLE_TCP_ACCEPT_STATE_CHANGING; in uv_tcp_simultaneous_accepts()
1489 int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) { in uv_tcp_open() argument
1506 err = uv__tcp_set_socket(handle->loop, in uv_tcp_open()
1507 handle, in uv_tcp_open()
1517 if (!uv_tcp_getsockname(handle, (struct sockaddr*) &saddr, &saddr_len)) { in uv_tcp_open()
1519 handle->flags |= UV_HANDLE_BOUND; in uv_tcp_open()
1521 if (!uv_tcp_getpeername(handle, (struct sockaddr*) &saddr, &saddr_len)) { in uv_tcp_open()
1523 uv__connection_init((uv_stream_t*) handle); in uv_tcp_open()
1524 handle->flags |= UV_HANDLE_READABLE | UV_HANDLE_WRITABLE; in uv_tcp_open()
1535 int uv__tcp_bind(uv_tcp_t* handle, in uv__tcp_bind() argument
1541 err = uv__tcp_try_bind(handle, addr, addrlen, flags); in uv__tcp_bind()
1553 uv_tcp_t* handle, in uv__tcp_connect() argument
1559 err = uv__tcp_try_connect(req, handle, addr, addrlen, cb); in uv__tcp_connect()