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

Side by Side Diff: webrtc/base/virtualsocketserver.cc

Issue 2097793003: Using fake clock for TURN port tests and un-disabling some tests. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Revising comments. Created 4 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 unified diff | Download patch
« no previous file with comments | « webrtc/base/gunit.h ('k') | webrtc/p2p/base/turnport_unittest.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
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 new MessageAddress(addr)); 764 new MessageAddress(addr));
765 } else { 765 } else {
766 LOG(LS_INFO) << "No one listening at " << remote_addr; 766 LOG(LS_INFO) << "No one listening at " << remote_addr;
767 msg_queue_->PostDelayed(RTC_FROM_HERE, delay, socket, MSG_ID_DISCONNECT); 767 msg_queue_->PostDelayed(RTC_FROM_HERE, delay, socket, MSG_ID_DISCONNECT);
768 } 768 }
769 return 0; 769 return 0;
770 } 770 }
771 771
772 bool VirtualSocketServer::Disconnect(VirtualSocket* socket) { 772 bool VirtualSocketServer::Disconnect(VirtualSocket* socket) {
773 if (socket) { 773 if (socket) {
774 // If we simulate packets being delayed, we should simulate the
775 // equivalent of a FIN being delayed as well.
776 uint32_t delay = GetRandomTransitDelay();
Taylor Brandstetter 2016/06/24 16:33:40 This is needed for the "TCP release allocation" te
774 // Remove the mapping. 777 // Remove the mapping.
775 msg_queue_->Post(RTC_FROM_HERE, socket, MSG_ID_DISCONNECT); 778 msg_queue_->PostDelayed(RTC_FROM_HERE, delay, socket, MSG_ID_DISCONNECT);
776 return true; 779 return true;
777 } 780 }
778 return false; 781 return false;
779 } 782 }
780 783
781 int VirtualSocketServer::SendUdp(VirtualSocket* socket, 784 int VirtualSocketServer::SendUdp(VirtualSocket* socket,
782 const char* data, size_t data_size, 785 const char* data, size_t data_size,
783 const SocketAddress& remote_addr) { 786 const SocketAddress& remote_addr) {
784 // See if we want to drop this packet. 787 // See if we want to drop this packet.
785 if (Random() < drop_prob_) { 788 if (Random() < drop_prob_) {
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) { 1144 void VirtualSocketServer::SetDefaultRoute(const IPAddress& from_addr) {
1142 RTC_DCHECK(!IPIsAny(from_addr)); 1145 RTC_DCHECK(!IPIsAny(from_addr));
1143 if (from_addr.family() == AF_INET) { 1146 if (from_addr.family() == AF_INET) {
1144 default_route_v4_ = from_addr; 1147 default_route_v4_ = from_addr;
1145 } else if (from_addr.family() == AF_INET6) { 1148 } else if (from_addr.family() == AF_INET6) {
1146 default_route_v6_ = from_addr; 1149 default_route_v6_ = from_addr;
1147 } 1150 }
1148 } 1151 }
1149 1152
1150 } // namespace rtc 1153 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/gunit.h ('k') | webrtc/p2p/base/turnport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698