[wpinet] uv::Stream: Return error from TryWrite() (#5655)

This commit is contained in:
Peter Johnson
2023-09-17 20:01:24 -07:00
committed by GitHub
parent 202a75fe08
commit 40b552be4a
2 changed files with 12 additions and 8 deletions

View File

@@ -111,25 +111,25 @@ void Stream::Write(std::span<const Buffer> bufs,
int Stream::TryWrite(std::span<const Buffer> bufs) {
if (IsLoopClosing()) {
return 0;
return UV_ECANCELED;
}
int val = uv_try_write(GetRawStream(), bufs.data(), bufs.size());
if (val < 0) {
this->ReportError(val);
return 0;
return val;
}
return val;
}
int Stream::TryWrite2(std::span<const Buffer> bufs, Stream& send) {
if (IsLoopClosing()) {
return 0;
return UV_ECANCELED;
}
int val = uv_try_write2(GetRawStream(), bufs.data(), bufs.size(),
send.GetRawStream());
if (val < 0) {
this->ReportError(val);
return 0;
return val;
}
return val;
}