Skip to content

Commit

Permalink
[ObjC] fix error handling in CFWriteStreamWrite (grpc#37344)
Browse files Browse the repository at this point in the history
follow up of grpc#37255

Closes grpc#37344

COPYBARA_INTEGRATE_REVIEW=grpc#37344 from HannahShiSFB:cfstream-write-error-handling c9a751d
PiperOrigin-RevId: 663329438
  • Loading branch information
HannahShiSFB authored and copybara-github committed Aug 15, 2024
1 parent e5f5f6e commit a09aaf0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,18 @@ void CFStreamEndpointImpl::DoWrite(
continue;
}

size_t written_size =
CFIndex written_size =
CFWriteStreamWrite(cf_write_stream_, slice.begin(), slice.size());

if (written_size < 0) {
auto status = CFErrorToStatus(CFWriteStreamCopyError(cf_write_stream_));
GRPC_TRACE_LOG(event_engine_endpoint, INFO)
<< "CFStream write error: " << status
<< ", written_size: " << written_size;
on_writable(status);
return;
}

total_written_size += written_size;
if (written_size < slice.size()) {
SliceBuffer written;
Expand Down

0 comments on commit a09aaf0

Please sign in to comment.