From 784630f0e63e6cc11cb44eb11db578d913e3d37d Mon Sep 17 00:00:00 2001 From: Taylor Brandstetter Date: Tue, 31 Mar 2020 13:32:42 -0700 Subject: [PATCH] Changing from hard to soft error when temporary DTLS buffer is full. We thought we had resolved this issue earlier, by reading DTLS records in a loop. But this condition may be triggered in other cases, such as when an internal DTLS error occurs and more DTLS records continue to be received afterwords. Changing this from a hard to soft error will avoid a crash (which is happening more frequently for whatever reason) and hopefully enable us to collect logs to debug the issue further. Bug: chromium:1063834 Change-Id: I22c01a9e064a9db65bab38d00c62a424b5a27437 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172560 Reviewed-by: Harald Alvestrand Reviewed-by: Jonas Oreland Commit-Queue: Jonas Oreland Cr-Commit-Position: refs/heads/master@{#30955} --- p2p/base/dtls_transport.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/p2p/base/dtls_transport.cc b/p2p/base/dtls_transport.cc index a5e29d0103..5ae61cadcd 100644 --- a/p2p/base/dtls_transport.cc +++ b/p2p/base/dtls_transport.cc @@ -99,12 +99,15 @@ rtc::StreamResult StreamInterfaceChannel::Write(const void* data, } bool StreamInterfaceChannel::OnPacketReceived(const char* data, size_t size) { - // We force a read event here to ensure that we don't overflow our queue. bool ret = packets_.WriteBack(data, size, NULL); - RTC_CHECK(ret) << "Failed to write packet to queue."; - if (ret) { - SignalEvent(this, rtc::SE_READ, 0); + if (!ret) { + // Somehow we received another packet before the SSLStreamAdapter read the + // previous one out of our temporary buffer. In this case, we'll log an + // error and still signal the read event, hoping that it will read the + // packet currently in packets_. + RTC_LOG(LS_ERROR) << "Failed to write packet to queue."; } + SignalEvent(this, rtc::SE_READ, 0); return ret; }