From 8ae1adc79aca52b4a1833ddd702309a85aac60c1 Mon Sep 17 00:00:00 2001 From: Victor Boivie Date: Thu, 14 Oct 2021 10:38:23 +0200 Subject: [PATCH] sctp: dcsctp: Don't log full send buffer as error When sending a large amount of data, the sender will want to keep the send buffer full so that the socket can quickly drain it as its able to put more bytes on the wire. When trying to send a message and when the send buffer is full, an error will be returned and the OnError callback will be triggered. In these situations, this is an expected and handled error and should not be logged as an error, as it causes confusion. Bug: chromium:1258225 Change-Id: I3e1feab03f60ba5c41cc524d8d8f066445030d18 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/235201 Reviewed-by: Florent Castelli Commit-Queue: Victor Boivie Cr-Commit-Position: refs/heads/main@{#35204} --- media/sctp/dcsctp_transport.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/media/sctp/dcsctp_transport.cc b/media/sctp/dcsctp_transport.cc index b6038b2e2f..4a5166863b 100644 --- a/media/sctp/dcsctp_transport.cc +++ b/media/sctp/dcsctp_transport.cc @@ -406,9 +406,18 @@ void DcSctpTransport::OnMessageReceived(dcsctp::DcSctpMessage message) { void DcSctpTransport::OnError(dcsctp::ErrorKind error, absl::string_view message) { - RTC_LOG(LS_ERROR) << debug_name_ - << "->OnError(error=" << dcsctp::ToString(error) - << ", message=" << message << ")."; + if (error == dcsctp::ErrorKind::kResourceExhaustion) { + // Indicates that a message failed to be enqueued, because the send buffer + // is full, which is a very common (and wanted) state for high throughput + // sending/benchmarks. + RTC_LOG(LS_VERBOSE) << debug_name_ + << "->OnError(error=" << dcsctp::ToString(error) + << ", message=" << message << ")."; + } else { + RTC_LOG(LS_ERROR) << debug_name_ + << "->OnError(error=" << dcsctp::ToString(error) + << ", message=" << message << ")."; + } } void DcSctpTransport::OnAborted(dcsctp::ErrorKind error,