Lines Matching refs:req
78 static size_t uv__write_req_size(uv_write_t* req);
441 uv_write_t* req; in uv__stream_flush_write_queue() local
447 req = uv__queue_data(q, uv_write_t, queue); in uv__stream_flush_write_queue()
448 req->error = error; in uv__stream_flush_write_queue()
450 uv__queue_insert_tail(&stream->write_completed_queue, &req->queue); in uv__stream_flush_write_queue()
627 uv_shutdown_t* req; in uv__drain() local
639 req = stream->shutdown_req; in uv__drain()
640 assert(req); in uv__drain()
656 if (req->cb != NULL) in uv__drain()
657 req->cb(req, err); in uv__drain()
670 static size_t uv__write_req_size(uv_write_t* req) { in uv__write_req_size() argument
673 assert(req->bufs != NULL); in uv__write_req_size()
674 size = uv__count_bufs(req->bufs + req->write_index, in uv__write_req_size()
675 req->nbufs - req->write_index); in uv__write_req_size()
676 assert(req->handle->write_queue_size >= size); in uv__write_req_size()
689 uv_write_t* req, in uv__write_req_update() argument
697 buf = req->bufs + req->write_index; in uv__write_req_update()
708 req->write_index = buf - req->bufs; in uv__write_req_update()
710 return req->write_index == req->nbufs; in uv__write_req_update()
714 static void uv__write_req_finish(uv_write_t* req) { in uv__write_req_finish() argument
715 uv_stream_t* stream = req->handle; in uv__write_req_finish()
718 uv__queue_remove(&req->queue); in uv__write_req_finish()
726 if (req->error == 0) { in uv__write_req_finish()
727 if (req->bufs != req->bufsml) in uv__write_req_finish()
728 uv__free(req->bufs); in uv__write_req_finish()
729 req->bufs = NULL; in uv__write_req_finish()
735 uv__queue_insert_tail(&stream->write_completed_queue, &req->queue); in uv__write_req_finish()
842 uv_write_t* req; in uv__write() local
859 req = uv__queue_data(q, uv_write_t, queue); in uv__write()
860 assert(req->handle == stream); in uv__write()
863 &(req->bufs[req->write_index]), in uv__write()
864 req->nbufs - req->write_index, in uv__write()
865 req->send_handle); in uv__write()
869 req->send_handle = NULL; in uv__write()
870 if (uv__write_req_update(stream, req, n)) { in uv__write()
871 uv__write_req_finish(req); in uv__write()
894 req->error = n; in uv__write()
895 uv__write_req_finish(req); in uv__write()
902 uv_write_t* req; in uv__write_callbacks() local
914 req = uv__queue_data(q, uv_write_t, queue); in uv__write_callbacks()
918 if (req->bufs != NULL) { in uv__write_callbacks()
919 stream->write_queue_size -= uv__write_req_size(req); in uv__write_callbacks()
920 if (req->bufs != req->bufsml) in uv__write_callbacks()
921 uv__free(req->bufs); in uv__write_callbacks()
922 req->bufs = NULL; in uv__write_callbacks()
926 if (req->cb) in uv__write_callbacks()
927 req->cb(req, req->error); in uv__write_callbacks()
1160 int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) { in uv_shutdown() argument
1176 uv__req_init(stream->loop, req, UV_SHUTDOWN); in uv_shutdown()
1177 req->handle = stream; in uv_shutdown()
1178 req->cb = cb; in uv_shutdown()
1179 stream->shutdown_req = req; in uv_shutdown()
1248 uv_connect_t* req = stream->connect_req; in uv__stream_connect() local
1252 assert(req); in uv__stream_connect()
1282 if (req->cb) in uv__stream_connect()
1283 req->cb(req, error); in uv__stream_connect()
1333 int uv_write2(uv_write_t* req, in uv_write2() argument
1355 uv__req_init(stream->loop, req, UV_WRITE); in uv_write2()
1356 req->cb = cb; in uv_write2()
1357 req->handle = stream; in uv_write2()
1358 req->error = 0; in uv_write2()
1359 req->send_handle = send_handle; in uv_write2()
1360 uv__queue_init(&req->queue); in uv_write2()
1362 req->bufs = req->bufsml; in uv_write2()
1363 if (nbufs > ARRAY_SIZE(req->bufsml)) in uv_write2()
1364 req->bufs = uv__malloc(nbufs * sizeof(bufs[0])); in uv_write2()
1366 if (req->bufs == NULL) in uv_write2()
1369 memcpy(req->bufs, bufs, nbufs * sizeof(bufs[0])); in uv_write2()
1370 req->nbufs = nbufs; in uv_write2()
1371 req->write_index = 0; in uv_write2()
1375 uv__queue_insert_tail(&stream->write_queue, &req->queue); in uv_write2()
1405 int uv_write(uv_write_t* req, in uv_write() argument
1410 return uv_write2(req, handle, bufs, nbufs, NULL, cb); in uv_write()