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

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

Issue 2625003003: Replace ASSERT(false) by RTC_NOTREACHED(). (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 | « webrtc/p2p/base/port.cc ('k') | webrtc/p2p/base/relayserver.cc » ('j') | 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
11 #include "webrtc/p2p/base/pseudotcp.h" 11 #include "webrtc/p2p/base/pseudotcp.h"
12 12
13 #include <stdio.h> 13 #include <stdio.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 15
16 #include <algorithm> 16 #include <algorithm>
17 #include <memory> 17 #include <memory>
18 #include <set> 18 #include <set>
19 19
20 #include "webrtc/base/arraysize.h" 20 #include "webrtc/base/arraysize.h"
21 #include "webrtc/base/basictypes.h" 21 #include "webrtc/base/basictypes.h"
22 #include "webrtc/base/bytebuffer.h" 22 #include "webrtc/base/bytebuffer.h"
23 #include "webrtc/base/byteorder.h" 23 #include "webrtc/base/byteorder.h"
24 #include "webrtc/base/checks.h"
24 #include "webrtc/base/common.h" 25 #include "webrtc/base/common.h"
25 #include "webrtc/base/logging.h" 26 #include "webrtc/base/logging.h"
26 #include "webrtc/base/socket.h" 27 #include "webrtc/base/socket.h"
27 #include "webrtc/base/stringutils.h" 28 #include "webrtc/base/stringutils.h"
28 #include "webrtc/base/timeutils.h" 29 #include "webrtc/base/timeutils.h"
29 30
30 // The following logging is for detailed (packet-level) analysis only. 31 // The following logging is for detailed (packet-level) analysis only.
31 #define _DBG_NONE 0 32 #define _DBG_NONE 0
32 #define _DBG_NORMAL 1 33 #define _DBG_NORMAL 1
33 #define _DBG_VERBOSE 2 34 #define _DBG_VERBOSE 2
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 285 }
285 } 286 }
286 287
287 void PseudoTcp::NotifyClock(uint32_t now) { 288 void PseudoTcp::NotifyClock(uint32_t now) {
288 if (m_state == TCP_CLOSED) 289 if (m_state == TCP_CLOSED)
289 return; 290 return;
290 291
291 // Check if it's time to retransmit a segment 292 // Check if it's time to retransmit a segment
292 if (m_rto_base && (rtc::TimeDiff32(m_rto_base + m_rx_rto, now) <= 0)) { 293 if (m_rto_base && (rtc::TimeDiff32(m_rto_base + m_rx_rto, now) <= 0)) {
293 if (m_slist.empty()) { 294 if (m_slist.empty()) {
294 ASSERT(false); 295 RTC_NOTREACHED();
295 } else { 296 } else {
296 // Note: (m_slist.front().xmit == 0)) { 297 // Note: (m_slist.front().xmit == 0)) {
297 // retransmit segments 298 // retransmit segments
298 #if _DEBUGMSG >= _DBG_NORMAL 299 #if _DEBUGMSG >= _DBG_NORMAL
299 LOG(LS_INFO) << "timeout retransmit (rto: " << m_rx_rto 300 LOG(LS_INFO) << "timeout retransmit (rto: " << m_rx_rto
300 << ") (rto_base: " << m_rto_base 301 << ") (rto_base: " << m_rto_base
301 << ") (now: " << now 302 << ") (now: " << now
302 << ") (dup_acks: " << static_cast<unsigned>(m_dup_acks) 303 << ") (dup_acks: " << static_cast<unsigned>(m_dup_acks)
303 << ")"; 304 << ")";
304 #endif // _DEBUGMSG 305 #endif // _DEBUGMSG
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 void PseudoTcp::GetOption(Option opt, int* value) { 372 void PseudoTcp::GetOption(Option opt, int* value) {
372 if (opt == OPT_NODELAY) { 373 if (opt == OPT_NODELAY) {
373 *value = m_use_nagling ? 0 : 1; 374 *value = m_use_nagling ? 0 : 1;
374 } else if (opt == OPT_ACKDELAY) { 375 } else if (opt == OPT_ACKDELAY) {
375 *value = m_ack_delay; 376 *value = m_ack_delay;
376 } else if (opt == OPT_SNDBUF) { 377 } else if (opt == OPT_SNDBUF) {
377 *value = m_sbuf_len; 378 *value = m_sbuf_len;
378 } else if (opt == OPT_RCVBUF) { 379 } else if (opt == OPT_RCVBUF) {
379 *value = m_rbuf_len; 380 *value = m_rbuf_len;
380 } else { 381 } else {
381 ASSERT(false); 382 RTC_NOTREACHED();
382 } 383 }
383 } 384 }
384 void PseudoTcp::SetOption(Option opt, int value) { 385 void PseudoTcp::SetOption(Option opt, int value) {
385 if (opt == OPT_NODELAY) { 386 if (opt == OPT_NODELAY) {
386 m_use_nagling = value == 0; 387 m_use_nagling = value == 0;
387 } else if (opt == OPT_ACKDELAY) { 388 } else if (opt == OPT_ACKDELAY) {
388 m_ack_delay = value; 389 m_ack_delay = value;
389 } else if (opt == OPT_SNDBUF) { 390 } else if (opt == OPT_SNDBUF) {
390 ASSERT(m_state == TCP_LISTEN); 391 ASSERT(m_state == TCP_LISTEN);
391 resizeSendBuffer(value); 392 resizeSendBuffer(value);
392 } else if (opt == OPT_RCVBUF) { 393 } else if (opt == OPT_RCVBUF) {
393 ASSERT(m_state == TCP_LISTEN); 394 ASSERT(m_state == TCP_LISTEN);
394 resizeReceiveBuffer(value); 395 resizeReceiveBuffer(value);
395 } else { 396 } else {
396 ASSERT(false); 397 RTC_NOTREACHED();
397 } 398 }
398 } 399 }
399 400
400 uint32_t PseudoTcp::GetCongestionWindow() const { 401 uint32_t PseudoTcp::GetCongestionWindow() const {
401 return m_cwnd; 402 return m_cwnd;
402 } 403 }
403 404
404 uint32_t PseudoTcp::GetBytesInFlight() const { 405 uint32_t PseudoTcp::GetBytesInFlight() const {
405 return m_snd_nxt - m_snd_una; 406 return m_snd_nxt - m_snd_una;
406 } 407 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 729 }
729 m_rx_rto = 730 m_rx_rto =
730 bound(MIN_RTO, m_rx_srtt + std::max<uint32_t>(1, 4 * m_rx_rttvar), 731 bound(MIN_RTO, m_rx_srtt + std::max<uint32_t>(1, 4 * m_rx_rttvar),
731 MAX_RTO); 732 MAX_RTO);
732 #if _DEBUGMSG >= _DBG_VERBOSE 733 #if _DEBUGMSG >= _DBG_VERBOSE
733 LOG(LS_INFO) << "rtt: " << rtt 734 LOG(LS_INFO) << "rtt: " << rtt
734 << " srtt: " << m_rx_srtt 735 << " srtt: " << m_rx_srtt
735 << " rto: " << m_rx_rto; 736 << " rto: " << m_rx_rto;
736 #endif // _DEBUGMSG 737 #endif // _DEBUGMSG
737 } else { 738 } else {
738 ASSERT(false); 739 RTC_NOTREACHED();
739 } 740 }
740 } 741 }
741 742
742 m_snd_wnd = static_cast<uint32_t>(seg.wnd) << m_swnd_scale; 743 m_snd_wnd = static_cast<uint32_t>(seg.wnd) << m_swnd_scale;
743 744
744 uint32_t nAcked = seg.ack - m_snd_una; 745 uint32_t nAcked = seg.ack - m_snd_una;
745 m_snd_una = seg.ack; 746 m_snd_una = seg.ack;
746 747
747 m_rto_base = (m_snd_una == m_snd_nxt) ? 0 : now; 748 m_rto_base = (m_snd_una == m_snd_nxt) ? 0 : now;
748 749
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 m_rbuf_len = new_size; 1278 m_rbuf_len = new_size;
1278 m_rwnd_scale = scale_factor; 1279 m_rwnd_scale = scale_factor;
1279 m_ssthresh = new_size; 1280 m_ssthresh = new_size;
1280 1281
1281 size_t available_space = 0; 1282 size_t available_space = 0;
1282 m_rbuf.GetWriteRemaining(&available_space); 1283 m_rbuf.GetWriteRemaining(&available_space);
1283 m_rcv_wnd = static_cast<uint32_t>(available_space); 1284 m_rcv_wnd = static_cast<uint32_t>(available_space);
1284 } 1285 }
1285 1286
1286 } // namespace cricket 1287 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | webrtc/p2p/base/relayserver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698