Lines Matching refs:req
88 uv_write_t req; /* Internal heap-allocated write request. */ member
542 uv_pipe_accept_t* req, BOOL firstInstance) { in pipe_alloc_accept() argument
543 assert(req->pipeHandle == INVALID_HANDLE_VALUE); in pipe_alloc_accept()
545 req->pipeHandle = in pipe_alloc_accept()
552 if (req->pipeHandle == INVALID_HANDLE_VALUE) { in pipe_alloc_accept()
557 if (CreateIoCompletionPort(req->pipeHandle, in pipe_alloc_accept()
567 handle->handle = req->pipeHandle; in pipe_alloc_accept()
576 uv_shutdown_t* req; in pipe_shutdown_thread_proc() local
578 req = (uv_shutdown_t*) parameter; in pipe_shutdown_thread_proc()
579 assert(req); in pipe_shutdown_thread_proc()
580 handle = (uv_pipe_t*) req->handle; in pipe_shutdown_thread_proc()
588 POST_COMPLETION_FOR_REQ(loop, req); in pipe_shutdown_thread_proc()
594 void uv__pipe_shutdown(uv_loop_t* loop, uv_pipe_t* handle, uv_shutdown_t *req) { in uv__pipe_shutdown() argument
601 assert(req != NULL); in uv__pipe_shutdown()
603 SET_REQ_SUCCESS(req); in uv__pipe_shutdown()
606 uv__insert_pending_req(loop, (uv_req_t*) req); in uv__pipe_shutdown()
618 SET_REQ_ERROR(req, pRtlNtStatusToDosError(nt_status)); in uv__pipe_shutdown()
620 uv__insert_pending_req(loop, (uv_req_t*) req); in uv__pipe_shutdown()
627 uv__insert_pending_req(loop, (uv_req_t*) req); in uv__pipe_shutdown()
633 req, in uv__pipe_shutdown()
636 SET_REQ_ERROR(req, GetLastError()); in uv__pipe_shutdown()
638 uv__insert_pending_req(loop, (uv_req_t*) req); in uv__pipe_shutdown()
715 uv_pipe_accept_t* req; in uv_pipe_bind2() local
762 req = &handle->pipe.serv.accept_reqs[i]; in uv_pipe_bind2()
763 UV_REQ_INIT(req, UV_ACCEPT); in uv_pipe_bind2()
764 req->data = handle; in uv_pipe_bind2()
765 req->pipeHandle = INVALID_HANDLE_VALUE; in uv_pipe_bind2()
766 req->next_pending = NULL; in uv_pipe_bind2()
817 uv_connect_t* req; in pipe_connect_thread_proc() local
821 req = (uv_connect_t*) parameter; in pipe_connect_thread_proc()
822 assert(req); in pipe_connect_thread_proc()
823 handle = (uv_pipe_t*) req->handle; in pipe_connect_thread_proc()
830 while (WaitNamedPipeW(req->u.connect.name, 30000)) { in pipe_connect_thread_proc()
832 pipeHandle = open_named_pipe(req->u.connect.name, &duplex_flags); in pipe_connect_thread_proc()
839 uv__free(req->u.connect.name); in pipe_connect_thread_proc()
840 req->u.connect.name = NULL; in pipe_connect_thread_proc()
842 SET_REQ_SUCCESS(req); in pipe_connect_thread_proc()
843 req->u.connect.pipeHandle = pipeHandle; in pipe_connect_thread_proc()
844 req->u.connect.duplex_flags = duplex_flags; in pipe_connect_thread_proc()
846 SET_REQ_ERROR(req, GetLastError()); in pipe_connect_thread_proc()
850 POST_COMPLETION_FOR_REQ(loop, req); in pipe_connect_thread_proc()
856 void uv_pipe_connect(uv_connect_t* req, in uv_pipe_connect() argument
863 err = uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); in uv_pipe_connect()
868 SET_REQ_ERROR(req, err); in uv_pipe_connect()
869 uv__insert_pending_req(loop, (uv_req_t*) req); in uv_pipe_connect()
876 int uv_pipe_connect2(uv_connect_t* req, in uv_pipe_connect2() argument
890 UV_REQ_INIT(req, UV_CONNECT); in uv_pipe_connect2()
891 req->handle = (uv_stream_t*) handle; in uv_pipe_connect2()
892 req->cb = cb; in uv_pipe_connect2()
893 req->u.connect.pipeHandle = INVALID_HANDLE_VALUE; in uv_pipe_connect2()
894 req->u.connect.duplex_flags = 0; in uv_pipe_connect2()
895 req->u.connect.name = NULL; in uv_pipe_connect2()
945 req->u.connect.name = uv__malloc(nameSize); in uv_pipe_connect2()
946 if (!req->u.connect.name) { in uv_pipe_connect2()
950 memcpy(req->u.connect.name, handle->name, nameSize); in uv_pipe_connect2()
954 req, in uv_pipe_connect2()
956 uv__free(req->u.connect.name); in uv_pipe_connect2()
957 req->u.connect.name = NULL; in uv_pipe_connect2()
972 req->u.connect.pipeHandle = pipeHandle; in uv_pipe_connect2()
973 req->u.connect.duplex_flags = duplex_flags; in uv_pipe_connect2()
974 SET_REQ_SUCCESS(req); in uv_pipe_connect2()
975 uv__insert_pending_req(loop, (uv_req_t*) req); in uv_pipe_connect2()
992 SET_REQ_ERROR(req, err); in uv_pipe_connect2()
993 uv__insert_pending_req(loop, (uv_req_t*) req); in uv_pipe_connect2()
1108 uv_pipe_accept_t* req, BOOL firstInstance) { in uv__pipe_queue_accept() argument
1111 if (!firstInstance && !pipe_alloc_accept(loop, handle, req, FALSE)) { in uv__pipe_queue_accept()
1112 SET_REQ_ERROR(req, GetLastError()); in uv__pipe_queue_accept()
1113 uv__insert_pending_req(loop, (uv_req_t*) req); in uv__pipe_queue_accept()
1118 assert(req->pipeHandle != INVALID_HANDLE_VALUE); in uv__pipe_queue_accept()
1121 memset(&(req->u.io.overlapped), 0, sizeof(req->u.io.overlapped)); in uv__pipe_queue_accept()
1123 if (!ConnectNamedPipe(req->pipeHandle, &req->u.io.overlapped) && in uv__pipe_queue_accept()
1126 SET_REQ_SUCCESS(req); in uv__pipe_queue_accept()
1128 CloseHandle(req->pipeHandle); in uv__pipe_queue_accept()
1129 req->pipeHandle = INVALID_HANDLE_VALUE; in uv__pipe_queue_accept()
1131 SET_REQ_ERROR(req, GetLastError()); in uv__pipe_queue_accept()
1133 uv__insert_pending_req(loop, (uv_req_t*) req); in uv__pipe_queue_accept()
1146 uv_pipe_accept_t* req; in uv__pipe_accept() local
1176 req = server->pipe.serv.pending_accepts; in uv__pipe_accept()
1178 if (!req) { in uv__pipe_accept()
1184 pipe_client->handle = req->pipeHandle; in uv__pipe_accept()
1188 server->pipe.serv.pending_accepts = req->next_pending; in uv__pipe_accept()
1189 req->next_pending = NULL; in uv__pipe_accept()
1190 req->pipeHandle = INVALID_HANDLE_VALUE; in uv__pipe_accept()
1194 uv__pipe_queue_accept(loop, server, req, FALSE); in uv__pipe_accept()
1243 uv_read_t* req = (uv_read_t*) arg; in uv_pipe_zero_readfile_thread_proc() local
1244 uv_pipe_t* handle = (uv_pipe_t*) req->data; in uv_pipe_zero_readfile_thread_proc()
1252 assert(req->type == UV_READ); in uv_pipe_zero_readfile_thread_proc()
1306 SET_REQ_ERROR(req, err); in uv_pipe_zero_readfile_thread_proc()
1308 SET_REQ_SUCCESS(req); in uv_pipe_zero_readfile_thread_proc()
1309 POST_COMPLETION_FOR_REQ(loop, req); in uv_pipe_zero_readfile_thread_proc()
1318 uv_write_t* req = (uv_write_t*) parameter; in uv_pipe_writefile_thread_proc() local
1319 uv_pipe_t* handle = (uv_pipe_t*) req->handle; in uv_pipe_writefile_thread_proc()
1322 assert(req != NULL); in uv_pipe_writefile_thread_proc()
1323 assert(req->type == UV_WRITE); in uv_pipe_writefile_thread_proc()
1327 req->write_buffer.base, in uv_pipe_writefile_thread_proc()
1328 req->write_buffer.len, in uv_pipe_writefile_thread_proc()
1333 SET_REQ_ERROR(req, GetLastError()); in uv_pipe_writefile_thread_proc()
1336 POST_COMPLETION_FOR_REQ(loop, req); in uv_pipe_writefile_thread_proc()
1342 uv_read_t* req; in post_completion_read_wait() local
1345 req = (uv_read_t*) context; in post_completion_read_wait()
1346 assert(req != NULL); in post_completion_read_wait()
1347 handle = (uv_tcp_t*)req->data; in post_completion_read_wait()
1352 req->u.io.overlapped.InternalHigh, in post_completion_read_wait()
1354 &req->u.io.overlapped)) { in post_completion_read_wait()
1361 uv_write_t* req; in post_completion_write_wait() local
1364 req = (uv_write_t*) context; in post_completion_write_wait()
1365 assert(req != NULL); in post_completion_write_wait()
1366 handle = (uv_tcp_t*)req->handle; in post_completion_write_wait()
1371 req->u.io.overlapped.InternalHigh, in post_completion_write_wait()
1373 &req->u.io.overlapped)) { in post_completion_write_wait()
1380 uv_read_t* req; in uv__pipe_queue_read() local
1388 req = &handle->read_req; in uv__pipe_queue_read()
1393 req, in uv__pipe_queue_read()
1396 SET_REQ_ERROR(req, GetLastError()); in uv__pipe_queue_read()
1400 memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); in uv__pipe_queue_read()
1402 assert(req->event_handle != NULL); in uv__pipe_queue_read()
1403 req->u.io.overlapped.hEvent = (HANDLE) ((uintptr_t) req->event_handle | 1); in uv__pipe_queue_read()
1411 &req->u.io.overlapped); in uv__pipe_queue_read()
1415 SET_REQ_ERROR(req, GetLastError()); in uv__pipe_queue_read()
1420 assert(req->wait_handle == INVALID_HANDLE_VALUE); in uv__pipe_queue_read()
1421 if (!RegisterWaitForSingleObject(&req->wait_handle, in uv__pipe_queue_read()
1422 req->event_handle, post_completion_read_wait, (void*) req, in uv__pipe_queue_read()
1424 SET_REQ_ERROR(req, GetLastError()); in uv__pipe_queue_read()
1437 uv__insert_pending_req(loop, (uv_req_t*)req); in uv__pipe_queue_read()
1471 uv_write_t* req) { in uv__insert_non_overlapped_write_req() argument
1472 req->next_req = NULL; in uv__insert_non_overlapped_write_req()
1474 req->next_req = in uv__insert_non_overlapped_write_req()
1476 handle->pipe.conn.non_overlapped_writes_tail->next_req = (uv_req_t*)req; in uv__insert_non_overlapped_write_req()
1477 handle->pipe.conn.non_overlapped_writes_tail = req; in uv__insert_non_overlapped_write_req()
1479 req->next_req = (uv_req_t*)req; in uv__insert_non_overlapped_write_req()
1480 handle->pipe.conn.non_overlapped_writes_tail = req; in uv__insert_non_overlapped_write_req()
1486 uv_write_t* req; in uv_remove_non_overlapped_write_req() local
1489 req = (uv_write_t*)handle->pipe.conn.non_overlapped_writes_tail->next_req; in uv_remove_non_overlapped_write_req()
1491 if (req == handle->pipe.conn.non_overlapped_writes_tail) { in uv_remove_non_overlapped_write_req()
1495 req->next_req; in uv_remove_non_overlapped_write_req()
1498 return req; in uv_remove_non_overlapped_write_req()
1507 uv_write_t* req = uv_remove_non_overlapped_write_req(handle); in uv__queue_non_overlapped_write() local
1508 if (req) { in uv__queue_non_overlapped_write()
1510 req, in uv__queue_non_overlapped_write()
1556 coalesced_write_req->req = *user_req; /* copy (a) */ in uv__build_coalesced_write_req()
1557 coalesced_write_req->req.coalesced = 1; in uv__build_coalesced_write_req()
1572 *req_out = &coalesced_write_req->req; in uv__build_coalesced_write_req()
1579 uv_write_t* req, in uv__pipe_write_data() argument
1591 UV_REQ_INIT(req, UV_WRITE); in uv__pipe_write_data()
1592 req->handle = (uv_stream_t*) handle; in uv__pipe_write_data()
1593 req->send_handle = NULL; in uv__pipe_write_data()
1594 req->cb = cb; in uv__pipe_write_data()
1596 req->coalesced = 0; in uv__pipe_write_data()
1597 req->event_handle = NULL; in uv__pipe_write_data()
1598 req->wait_handle = INVALID_HANDLE_VALUE; in uv__pipe_write_data()
1601 memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); in uv__pipe_write_data()
1603 req->event_handle = CreateEvent(NULL, 0, 0, NULL); in uv__pipe_write_data()
1604 if (req->event_handle == NULL) { in uv__pipe_write_data()
1607 req->u.io.overlapped.hEvent = (HANDLE) ((uintptr_t) req->event_handle | 1); in uv__pipe_write_data()
1609 req->write_buffer = uv_null_buf_; in uv__pipe_write_data()
1620 err = uv__build_coalesced_write_req(req, bufs, nbufs, &req, &write_buf); in uv__pipe_write_data()
1637 req->u.io.queued_bytes = 0; in uv__pipe_write_data()
1643 POST_COMPLETION_FOR_REQ(loop, req); in uv__pipe_write_data()
1646 req->write_buffer = write_buf; in uv__pipe_write_data()
1647 uv__insert_non_overlapped_write_req(handle, req); in uv__pipe_write_data()
1653 req->u.io.queued_bytes = write_buf.len; in uv__pipe_write_data()
1654 handle->write_queue_size += req->u.io.queued_bytes; in uv__pipe_write_data()
1661 &req->u.io.overlapped); in uv__pipe_write_data()
1665 CloseHandle(req->event_handle); in uv__pipe_write_data()
1666 req->event_handle = NULL; in uv__pipe_write_data()
1672 req->u.io.queued_bytes = 0; in uv__pipe_write_data()
1675 req->u.io.queued_bytes = write_buf.len; in uv__pipe_write_data()
1676 handle->write_queue_size += req->u.io.queued_bytes; in uv__pipe_write_data()
1677 if (WaitForSingleObject(req->event_handle, INFINITE) != in uv__pipe_write_data()
1680 CloseHandle(req->event_handle); in uv__pipe_write_data()
1681 req->event_handle = NULL; in uv__pipe_write_data()
1685 CloseHandle(req->event_handle); in uv__pipe_write_data()
1686 req->event_handle = NULL; in uv__pipe_write_data()
1697 &req->u.io.overlapped); in uv__pipe_write_data()
1705 req->u.io.queued_bytes = 0; in uv__pipe_write_data()
1708 req->u.io.queued_bytes = write_buf.len; in uv__pipe_write_data()
1709 handle->write_queue_size += req->u.io.queued_bytes; in uv__pipe_write_data()
1713 if (!RegisterWaitForSingleObject(&req->wait_handle, in uv__pipe_write_data()
1714 req->event_handle, post_completion_write_wait, (void*) req, in uv__pipe_write_data()
1747 uv_write_t* req, in uv__pipe_write_ipc() argument
1837 err = uv__pipe_write_data(loop, req, handle, bufs, buf_count, cb, 1); in uv__pipe_write_ipc()
1849 uv_write_t* req, in uv__pipe_write() argument
1857 return uv__pipe_write_ipc(loop, req, handle, bufs, nbufs, send_handle, cb); in uv__pipe_write()
1861 return uv__pipe_write_data(loop, req, handle, bufs, nbufs, cb, 0); in uv__pipe_write()
1922 uv_read_t* req; in uv__pipe_read_exactly() local
1928 req = &handle->read_req; in uv__pipe_read_exactly()
1929 memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); in uv__pipe_read_exactly()
1930 req->u.io.overlapped.hEvent = (HANDLE) ((uintptr_t) req->event_handle | 1); in uv__pipe_read_exactly()
1935 &req->u.io.overlapped)) { in uv__pipe_read_exactly()
1938 if (!GetOverlappedResult(handle->handle, &req->u.io.overlapped, &bytes_read_now, TRUE)) in uv__pipe_read_exactly()
1955 uv_read_t* req; in uv__pipe_read_data() local
1997 req = &handle->read_req; in uv__pipe_read_data()
1998 memset(&req->u.io.overlapped, 0, sizeof(req->u.io.overlapped)); in uv__pipe_read_data()
1999 req->u.io.overlapped.hEvent = (HANDLE) ((uintptr_t) req->event_handle | 1); in uv__pipe_read_data()
2000 if (ReadFile(handle->handle, buf.base, max_bytes, bytes_read, &req->u.io.overlapped)) { in uv__pipe_read_data()
2006 r = CancelIoEx(handle->handle, &req->u.io.overlapped); in uv__pipe_read_data()
2008 if (GetOverlappedResult(handle->handle, &req->u.io.overlapped, bytes_read, TRUE)) { in uv__pipe_read_data()
2118 uv_req_t* req) { in uv__process_pipe_read_req() argument
2139 if (!REQ_SUCCESS(req)) { in uv__process_pipe_read_req()
2141 err = GET_REQ_ERROR(req); in uv__process_pipe_read_req()
2176 uv_write_t* req) { in uv__process_pipe_write_req() argument
2181 assert(handle->write_queue_size >= req->u.io.queued_bytes); in uv__process_pipe_write_req()
2182 handle->write_queue_size -= req->u.io.queued_bytes; in uv__process_pipe_write_req()
2186 if (req->wait_handle != INVALID_HANDLE_VALUE) { in uv__process_pipe_write_req()
2187 UnregisterWait(req->wait_handle); in uv__process_pipe_write_req()
2188 req->wait_handle = INVALID_HANDLE_VALUE; in uv__process_pipe_write_req()
2190 if (req->event_handle) { in uv__process_pipe_write_req()
2191 CloseHandle(req->event_handle); in uv__process_pipe_write_req()
2192 req->event_handle = NULL; in uv__process_pipe_write_req()
2195 err = GET_REQ_ERROR(req); in uv__process_pipe_write_req()
2200 if (req->coalesced) { in uv__process_pipe_write_req()
2202 container_of(req, uv__coalesced_write_t, req); in uv__process_pipe_write_req()
2203 req = coalesced_write->user_req; in uv__process_pipe_write_req()
2206 if (req->cb) { in uv__process_pipe_write_req()
2207 req->cb(req, uv_translate_sys_error(err)); in uv__process_pipe_write_req()
2228 uv_pipe_accept_t* req = (uv_pipe_accept_t*) raw_req; in uv__process_pipe_accept_req() local
2234 assert(req->pipeHandle == INVALID_HANDLE_VALUE); in uv__process_pipe_accept_req()
2239 if (REQ_SUCCESS(req)) { in uv__process_pipe_accept_req()
2240 assert(req->pipeHandle != INVALID_HANDLE_VALUE); in uv__process_pipe_accept_req()
2241 req->next_pending = handle->pipe.serv.pending_accepts; in uv__process_pipe_accept_req()
2242 handle->pipe.serv.pending_accepts = req; in uv__process_pipe_accept_req()
2248 if (req->pipeHandle != INVALID_HANDLE_VALUE) { in uv__process_pipe_accept_req()
2249 CloseHandle(req->pipeHandle); in uv__process_pipe_accept_req()
2250 req->pipeHandle = INVALID_HANDLE_VALUE; in uv__process_pipe_accept_req()
2253 uv__pipe_queue_accept(loop, handle, req, FALSE); in uv__process_pipe_accept_req()
2262 uv_connect_t* req) { in uv__process_pipe_connect_req() argument
2272 if (REQ_SUCCESS(req)) { in uv__process_pipe_connect_req()
2273 pipeHandle = req->u.connect.pipeHandle; in uv__process_pipe_connect_req()
2274 duplex_flags = req->u.connect.duplex_flags; in uv__process_pipe_connect_req()
2282 err = uv_translate_sys_error(GET_REQ_ERROR(req)); in uv__process_pipe_connect_req()
2285 if (req->cb) in uv__process_pipe_connect_req()
2286 req->cb(req, err); in uv__process_pipe_connect_req()
2294 uv_shutdown_t* req) { in uv__process_pipe_shutdown_req() argument
2306 } else if (!REQ_SUCCESS(req)) { in uv__process_pipe_shutdown_req()
2308 err = uv_translate_sys_error(GET_REQ_ERROR(req)); in uv__process_pipe_shutdown_req()
2329 if (req->cb) in uv__process_pipe_shutdown_req()
2330 req->cb(req, err); in uv__process_pipe_shutdown_req()