Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: document DoWrite() usage expectations #26339

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/stream_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,14 @@ class StreamResource {
// `*bufs` and `*count` accordingly. This is a no-op by default.
// Return 0 for success and a libuv error code for failures.
virtual int DoTryWrite(uv_buf_t** bufs, size_t* count);
// Perform a write of data, and either call req_wrap->Done() when finished
// and return 0, or return a libuv error code for synchronous failures.
// Initiate a write of data. If the write completes synchronously, return 0 on
// success (with bufs modified to indicate how much data was consumed) or a
// libuv error code on failure. If the write will complete asynchronously,
// return 0. When the write completes asynchronously, call req_wrap->Done()
// with 0 on success (with bufs modified to indicate how much data was
// consumed) or a libuv error code on failure. Do not call req_wrap->Done() if
// the write completes synchronously, that is, it should never be called
// before DoWrite() has returned.
virtual int DoWrite(WriteWrap* w,
uv_buf_t* bufs,
size_t count,
Expand Down