Fix bug 574524: DtlsTransportChannel crashes after SSL closes remotely

When remote side closes, opensslstreamadapter could return SR_EOS which will not trigger upper layer to clean up what's left in the StreamInterfaceChannel. The result of this is when there are more packets coming in, the Write on the StreamInterfaceChannel will overflow the buffer.

The fix here is that when receiving the remote side close signal, we also close the underneath StreamInterfaceChannel which will clean up the queue to prevent overflow.

BUG=574524
TBR=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1566023002

Cr-Commit-Position: refs/heads/master@{#11751}
diff --git a/webrtc/base/bufferqueue.h b/webrtc/base/bufferqueue.h
index 89ffdf0..623d85a 100644
--- a/webrtc/base/bufferqueue.h
+++ b/webrtc/base/bufferqueue.h
@@ -28,6 +28,9 @@
   // Return number of queued buffers.
   size_t size() const;
 
+  // Clear the BufferQueue by moving all Buffers from |queue_| to |free_list_|.
+  void Clear();
+
   // ReadFront will only read one buffer at a time and will truncate buffers
   // that don't fit in the passed memory.
   // Returns true unless no data could be returned.