[ObjC] fix error handling in CFWriteStreamWrite (#37344)

follow up of #37255

Closes #37344

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37344 from HannahShiSFB:cfstream-write-error-handling c9a751d9d7
PiperOrigin-RevId: 663329438
pull/37506/head
Hannah Shi 4 months ago committed by Copybara-Service
parent e5f5f6e039
commit a09aaf06ec
  1. 11
      src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc

@ -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;

Loading…
Cancel
Save