Index: webrtc/p2p/base/dtlstransportchannel.cc |
diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc |
index f5d658340baefacaf83494c48afa9f1d08f94fda..bad17500b06cec0bc5d6fd1cd1ef0dddf1dcc04c 100644 |
--- a/webrtc/p2p/base/dtlstransportchannel.cc |
+++ b/webrtc/p2p/base/dtlstransportchannel.cc |
@@ -537,20 +537,23 @@ void DtlsTransport::OnDtlsEvent(rtc::StreamInterface* dtls, int sig, int err) { |
char buf[kMaxDtlsPacketLen]; |
size_t read; |
int read_error; |
- rtc::StreamResult ret = dtls_->Read(buf, sizeof(buf), &read, &read_error); |
- if (ret == rtc::SR_SUCCESS) { |
- SignalReadPacket(this, buf, read, rtc::CreatePacketTime(0), 0); |
- } else if (ret == rtc::SR_EOS) { |
- // Remote peer shut down the association with no error. |
- LOG_J(LS_INFO, this) << "DTLS transport closed"; |
- set_writable(false); |
- set_dtls_state(DTLS_TRANSPORT_CLOSED); |
- } else if (ret == rtc::SR_ERROR) { |
- // Remote peer shut down the association with an error. |
- LOG_J(LS_INFO, this) << "DTLS transport error, code=" << read_error; |
- set_writable(false); |
- set_dtls_state(DTLS_TRANSPORT_FAILED); |
- } |
+ rtc::StreamResult ret; |
+ do { |
Taylor Brandstetter
2017/07/06 22:06:11
Could use a comment explaining why this is done in
joachim
2017/07/07 16:12:59
Done.
|
+ ret = dtls_->Read(buf, sizeof(buf), &read, &read_error); |
+ if (ret == rtc::SR_SUCCESS) { |
+ SignalReadPacket(this, buf, read, rtc::CreatePacketTime(0), 0); |
+ } else if (ret == rtc::SR_EOS) { |
+ // Remote peer shut down the association with no error. |
+ LOG_J(LS_INFO, this) << "DTLS transport closed"; |
+ set_writable(false); |
+ set_dtls_state(DTLS_TRANSPORT_CLOSED); |
+ } else if (ret == rtc::SR_ERROR) { |
+ // Remote peer shut down the association with an error. |
+ LOG_J(LS_INFO, this) << "DTLS transport error, code=" << read_error; |
+ set_writable(false); |
+ set_dtls_state(DTLS_TRANSPORT_FAILED); |
+ } |
+ } while (ret == rtc::SR_SUCCESS); |
} |
if (sig & rtc::SE_CLOSE) { |
RTC_DCHECK(sig == rtc::SE_CLOSE); // SE_CLOSE should be by itself. |