OLD | NEW |
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // IPStream Implementation | 419 // IPStream Implementation |
420 // | 420 // |
421 | 421 |
422 int PseudoTcp::Recv(char* buffer, size_t len) { | 422 int PseudoTcp::Recv(char* buffer, size_t len) { |
423 if (m_state != TCP_ESTABLISHED) { | 423 if (m_state != TCP_ESTABLISHED) { |
424 m_error = ENOTCONN; | 424 m_error = ENOTCONN; |
425 return SOCKET_ERROR; | 425 return SOCKET_ERROR; |
426 } | 426 } |
427 | 427 |
428 size_t read = 0; | 428 size_t read = 0; |
429 rtc::StreamResult result = m_rbuf.Read(buffer, len, &read, NULL); | 429 rtc::StreamResult result = m_rbuf.Read(buffer, len, &read, nullptr); |
430 | 430 |
431 // If there's no data in |m_rbuf|. | 431 // If there's no data in |m_rbuf|. |
432 if (result == rtc::SR_BLOCK) { | 432 if (result == rtc::SR_BLOCK) { |
433 m_bReadEnable = true; | 433 m_bReadEnable = true; |
434 m_error = EWOULDBLOCK; | 434 m_error = EWOULDBLOCK; |
435 return SOCKET_ERROR; | 435 return SOCKET_ERROR; |
436 } | 436 } |
437 RTC_DCHECK(result == rtc::SR_SUCCESS); | 437 RTC_DCHECK(result == rtc::SR_SUCCESS); |
438 | 438 |
439 size_t available_space = 0; | 439 size_t available_space = 0; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 (m_slist.back().xmit == 0)) { | 501 (m_slist.back().xmit == 0)) { |
502 m_slist.back().len += len; | 502 m_slist.back().len += len; |
503 } else { | 503 } else { |
504 size_t snd_buffered = 0; | 504 size_t snd_buffered = 0; |
505 m_sbuf.GetBuffered(&snd_buffered); | 505 m_sbuf.GetBuffered(&snd_buffered); |
506 SSegment sseg(static_cast<uint32_t>(m_snd_una + snd_buffered), len, bCtrl); | 506 SSegment sseg(static_cast<uint32_t>(m_snd_una + snd_buffered), len, bCtrl); |
507 m_slist.push_back(sseg); | 507 m_slist.push_back(sseg); |
508 } | 508 } |
509 | 509 |
510 size_t written = 0; | 510 size_t written = 0; |
511 m_sbuf.Write(data, len, &written, NULL); | 511 m_sbuf.Write(data, len, &written, nullptr); |
512 return static_cast<uint32_t>(written); | 512 return static_cast<uint32_t>(written); |
513 } | 513 } |
514 | 514 |
515 IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32_t seq, | 515 IPseudoTcpNotify::WriteResult PseudoTcp::packet(uint32_t seq, |
516 uint8_t flags, | 516 uint8_t flags, |
517 uint32_t offset, | 517 uint32_t offset, |
518 uint32_t len) { | 518 uint32_t len) { |
519 RTC_DCHECK(HEADER_SIZE + len <= MAX_PACKET); | 519 RTC_DCHECK(HEADER_SIZE + len <= MAX_PACKET); |
520 | 520 |
521 uint32_t now = Now(); | 521 uint32_t now = Now(); |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 | 902 |
903 if (seg.len > 0) { | 903 if (seg.len > 0) { |
904 if (bIgnoreData) { | 904 if (bIgnoreData) { |
905 if (seg.seq == m_rcv_nxt) { | 905 if (seg.seq == m_rcv_nxt) { |
906 m_rcv_nxt += seg.len; | 906 m_rcv_nxt += seg.len; |
907 } | 907 } |
908 } else { | 908 } else { |
909 uint32_t nOffset = seg.seq - m_rcv_nxt; | 909 uint32_t nOffset = seg.seq - m_rcv_nxt; |
910 | 910 |
911 rtc::StreamResult result = | 911 rtc::StreamResult result = |
912 m_rbuf.WriteOffset(seg.data, seg.len, nOffset, NULL); | 912 m_rbuf.WriteOffset(seg.data, seg.len, nOffset, nullptr); |
913 if (result == rtc::SR_BLOCK) { | 913 if (result == rtc::SR_BLOCK) { |
914 // Ignore incoming packets outside of the receive window. | 914 // Ignore incoming packets outside of the receive window. |
915 return false; | 915 return false; |
916 } | 916 } |
917 | 917 |
918 RTC_DCHECK(result == rtc::SR_SUCCESS); | 918 RTC_DCHECK(result == rtc::SR_SUCCESS); |
919 | 919 |
920 if (seg.seq == m_rcv_nxt) { | 920 if (seg.seq == m_rcv_nxt) { |
921 m_rbuf.ConsumeWriteBuffer(seg.len); | 921 m_rbuf.ConsumeWriteBuffer(seg.len); |
922 m_rcv_nxt += seg.len; | 922 m_rcv_nxt += seg.len; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 m_rbuf_len = new_size; | 1277 m_rbuf_len = new_size; |
1278 m_rwnd_scale = scale_factor; | 1278 m_rwnd_scale = scale_factor; |
1279 m_ssthresh = new_size; | 1279 m_ssthresh = new_size; |
1280 | 1280 |
1281 size_t available_space = 0; | 1281 size_t available_space = 0; |
1282 m_rbuf.GetWriteRemaining(&available_space); | 1282 m_rbuf.GetWriteRemaining(&available_space); |
1283 m_rcv_wnd = static_cast<uint32_t>(available_space); | 1283 m_rcv_wnd = static_cast<uint32_t>(available_space); |
1284 } | 1284 } |
1285 | 1285 |
1286 } // namespace cricket | 1286 } // namespace cricket |
OLD | NEW |