Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Unified Diff: webrtc/p2p/base/dtlstransportchannel.cc

Issue 2970883005: Handle case where UDP packet contains multiple DTLS records. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « no previous file | webrtc/p2p/base/dtlstransportchannel_unittest.cc » ('j') | webrtc/p2p/base/dtlstransportchannel_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698