Skip to content

Commit 9719a8a

Browse files
committed
src,stream: improve DoWrite() and Write()
fix comment
1 parent 2ec39cd commit 9719a8a

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/stream_base.h

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,22 +245,18 @@ class StreamResource {
245245
// Return 0 for success and a libuv error code for failures.
246246
virtual int DoTryWrite(uv_buf_t** bufs, size_t* count);
247247
// Initiate a write of data.
248-
//
249-
// On an immediate failure, a libuv error code is returned,
250-
// req_wrap->Done() will never be called and caller should free `bufs`.
251-
//
252-
// Otherwise, 0 is returned and req_wrap->Done(status) will be called
248+
// Upon an immediate failure, a libuv error code is returned,
249+
// w->Done() will never be called and caller should free `bufs`.
250+
// Otherwise, 0 is returned and w->Done(status) will be called
253251
// with status set to either
254252
// (1) 0 after all data are written, or
255253
// (2) a libuv error code when an error occurs
256-
// in either case, req_wrap->Done() will never be called before DoWrite()
257-
// returns.
258-
//
254+
// in either case, w->Done() will never be called before DoWrite() returns.
259255
// When 0 is returned:
260256
// (1) memory specified by `bufs` and `count` must remain valid until
261-
// req_wrap->Done() gets called.
257+
// w->Done() gets called.
262258
// (2) `bufs` might or might not be changed, caller should not rely on this.
263-
// (3) `bufs` should be freed after req_wrap->Done() gets called.
259+
// (3) `bufs` should be freed after w->Done() gets called.
264260
virtual int DoWrite(WriteWrap* w,
265261
uv_buf_t* bufs,
266262
size_t count,

0 commit comments

Comments
 (0)