-
Notifications
You must be signed in to change notification settings - Fork 653
Add uv_try_write on windows #1464
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -876,6 +876,22 @@ int uv_tcp_write(uv_loop_t* loop, | |||
} | ||||
|
||||
|
||||
int uv_tcp_try_write(uv_tcp_t* handle, | ||||
const uv_buf_t bufs[], | ||||
unsigned int nbufs) { | ||||
DWORD bytes = 0; | ||||
if (WSASend(((uv_tcp_t*) handle)->socket, | ||||
(WSABUF*) bufs, | ||||
nbufs, | ||||
&bytes, | ||||
0, | ||||
NULL, | ||||
NULL) == 0) | ||||
return (int) bytes; | ||||
return uv_translate_sys_error(WSAGetLastError()); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be returning some sort of EAGAIN if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not only, we also need to return it if there are other write requests pending. That's why I we need to wait for #1439. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Does uv_translate_sys_error not do this?
It would be possible to just look at the Line 412 in 49cb40c
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Just like we do on linux. |
||||
} | ||||
|
||||
|
||||
void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, | ||||
uv_req_t* req) { | ||||
DWORD bytes, flags, err; | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do
UV_ENOSYS
trick here, not just fail :)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what is the spec.
See https://github.com/joyent/libuv/blob/master/src/win/stream.c#L42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no written spec per se, but we try to not fail so abuptly. Please return an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done c20bb22