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

Side by Side Diff: webrtc/p2p/base/pseudotcp.cc

Issue 2640173002: Fix PseudoTcp to handle incoming packets with invalid SEQ field (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 bool bNewData = false; 903 bool bNewData = false;
904 904
905 if (seg.len > 0) { 905 if (seg.len > 0) {
906 if (bIgnoreData) { 906 if (bIgnoreData) {
907 if (seg.seq == m_rcv_nxt) { 907 if (seg.seq == m_rcv_nxt) {
908 m_rcv_nxt += seg.len; 908 m_rcv_nxt += seg.len;
909 } 909 }
910 } else { 910 } else {
911 uint32_t nOffset = seg.seq - m_rcv_nxt; 911 uint32_t nOffset = seg.seq - m_rcv_nxt;
912 912
913 rtc::StreamResult result = m_rbuf.WriteOffset(seg.data, seg.len, 913 rtc::StreamResult result =
914 nOffset, NULL); 914 m_rbuf.WriteOffset(seg.data, seg.len, nOffset, NULL);
915 if (result == rtc::SR_BLOCK) {
916 // Ignore incoming packets outside of the receive window.
917 return false;
918 }
919
915 RTC_DCHECK(result == rtc::SR_SUCCESS); 920 RTC_DCHECK(result == rtc::SR_SUCCESS);
916 RTC_UNUSED(result); 921 RTC_UNUSED(result);
nisse-webrtc 2017/01/19 07:44:16 You can delete this RTC_UNUSED, it's a left over f
Sergey Ulanov 2017/01/19 18:06:32 Done.
917 922
918 if (seg.seq == m_rcv_nxt) { 923 if (seg.seq == m_rcv_nxt) {
919 m_rbuf.ConsumeWriteBuffer(seg.len); 924 m_rbuf.ConsumeWriteBuffer(seg.len);
920 m_rcv_nxt += seg.len; 925 m_rcv_nxt += seg.len;
921 m_rcv_wnd -= seg.len; 926 m_rcv_wnd -= seg.len;
922 bNewData = true; 927 bNewData = true;
923 928
924 RList::iterator it = m_rlist.begin(); 929 RList::iterator it = m_rlist.begin();
925 while ((it != m_rlist.end()) && (it->seq <= m_rcv_nxt)) { 930 while ((it != m_rlist.end()) && (it->seq <= m_rcv_nxt)) {
926 if (it->seq + it->len > m_rcv_nxt) { 931 if (it->seq + it->len > m_rcv_nxt) {
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 m_rbuf_len = new_size; 1283 m_rbuf_len = new_size;
1279 m_rwnd_scale = scale_factor; 1284 m_rwnd_scale = scale_factor;
1280 m_ssthresh = new_size; 1285 m_ssthresh = new_size;
1281 1286
1282 size_t available_space = 0; 1287 size_t available_space = 0;
1283 m_rbuf.GetWriteRemaining(&available_space); 1288 m_rbuf.GetWriteRemaining(&available_space);
1284 m_rcv_wnd = static_cast<uint32_t>(available_space); 1289 m_rcv_wnd = static_cast<uint32_t>(available_space);
1285 } 1290 }
1286 1291
1287 } // namespace cricket 1292 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698