Index: webrtc/base/opensslstreamadapter.cc |
diff --git a/webrtc/base/opensslstreamadapter.cc b/webrtc/base/opensslstreamadapter.cc |
index 270faa0809f42013c01aeb35854d7c98b3b9cc1f..616914a654530143f16a7947beed26bc13824432 100644 |
--- a/webrtc/base/opensslstreamadapter.cc |
+++ b/webrtc/base/opensslstreamadapter.cc |
@@ -618,6 +618,10 @@ StreamResult OpenSSLStreamAdapter::Read(void* data, size_t data_len, |
return SR_BLOCK; |
case SSL_ERROR_ZERO_RETURN: |
LOG(LS_VERBOSE) << " -- remote side closed"; |
+ // When we're closed at SSL layer, also close the stream level which |
+ // performs necessary clean up. Otherwise, a new incoming packet after |
+ // this could overflow the stream buffer. |
+ this->stream()->Close(); |
return SR_EOS; |
break; |
default: |