Improve DTLS logging.

See b/142641135.

Bug: None
Change-Id: I59d74b0d6c53a421d8104cc5455bab2e8dcf27d4
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/166048
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30280}
diff --git a/p2p/base/dtls_transport.cc b/p2p/base/dtls_transport.cc
index 3eba7c6..9d49c09 100644
--- a/p2p/base/dtls_transport.cc
+++ b/p2p/base/dtls_transport.cc
@@ -419,8 +419,16 @@
                    : -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 @@
       // 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;
   }
 }