From e2747b8e0de3b6a02e0f8b8a4f46b815738bc785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 16 Jan 2020 12:41:50 +0100 Subject: [PATCH] Improve DTLS logging. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See b/142641135. Bug: None Change-Id: I59d74b0d6c53a421d8104cc5455bab2e8dcf27d4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166048 Commit-Queue: Henrik Boström Reviewed-by: Harald Alvestrand Cr-Commit-Position: refs/heads/master@{#30280} --- p2p/base/dtls_transport.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/p2p/base/dtls_transport.cc b/p2p/base/dtls_transport.cc index 3eba7c680d..9d49c09894 100644 --- a/p2p/base/dtls_transport.cc +++ b/p2p/base/dtls_transport.cc @@ -419,8 +419,16 @@ int DtlsTransport::SendPacket(const char* data, : -1; } case DTLS_TRANSPORT_FAILED: + // Can't send anything when we're failed. + RTC_LOG(LS_ERROR) + << ToString() + << ": Couldn't send packet due to DTLS_TRANSPORT_FAILED."; + return -1; case DTLS_TRANSPORT_CLOSED: // Can't send anything when we're closed. + RTC_LOG(LS_ERROR) + << ToString() + << ": Couldn't send packet due to DTLS_TRANSPORT_CLOSED."; return -1; default: RTC_NOTREACHED(); @@ -510,8 +518,16 @@ void DtlsTransport::OnWritableState(rtc::PacketTransportInternal* transport) { // Do nothing. break; case DTLS_TRANSPORT_FAILED: + // Should not happen. Do nothing. + RTC_LOG(LS_ERROR) + << ToString() + << ": OnWritableState() called in state DTLS_TRANSPORT_FAILED."; + break; case DTLS_TRANSPORT_CLOSED: // Should not happen. Do nothing. + RTC_LOG(LS_ERROR) + << ToString() + << ": OnWritableState() called in state DTLS_TRANSPORT_CLOSED."; break; } }