[ObjC] Skip 0-length slices when writing to CFWriteStream (#37246) (#37255)

#37246

Closes #37255

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37255 from ziglerari:cfstream-zero-length-buffers 21c9db1b5d
PiperOrigin-RevId: 657770743
pull/37116/head^2
ziglerari 6 months ago committed by Copybara-Service
parent cd068cb818
commit 78cfebc3bd
  1. 4
      src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc

@ -331,6 +331,10 @@ void CFStreamEndpointImpl::DoWrite(
size_t total_written_size = 0;
for (size_t i = 0; i < data->Count(); i++) {
auto slice = data->RefSlice(i);
if (slice.size() == 0) {
continue;
}
size_t written_size =
CFWriteStreamWrite(cf_write_stream_, slice.begin(), slice.size());

Loading…
Cancel
Save