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

Side by Side Diff: webrtc/p2p/base/turnserver.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, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2012 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 void TurnServer::Send(TurnServerConnection* conn, 502 void TurnServer::Send(TurnServerConnection* conn,
503 const rtc::ByteBufferWriter& buf) { 503 const rtc::ByteBufferWriter& buf) {
504 rtc::PacketOptions options; 504 rtc::PacketOptions options;
505 conn->socket()->SendTo(buf.Data(), buf.Length(), conn->src(), options); 505 conn->socket()->SendTo(buf.Data(), buf.Length(), conn->src(), options);
506 } 506 }
507 507
508 void TurnServer::OnAllocationDestroyed(TurnServerAllocation* allocation) { 508 void TurnServer::OnAllocationDestroyed(TurnServerAllocation* allocation) {
509 // Removing the internal socket if the connection is not udp. 509 // Removing the internal socket if the connection is not udp.
510 rtc::AsyncPacketSocket* socket = allocation->conn()->socket(); 510 rtc::AsyncPacketSocket* socket = allocation->conn()->socket();
511 InternalSocketMap::iterator iter = server_sockets_.find(socket); 511 InternalSocketMap::iterator iter = server_sockets_.find(socket);
512 ASSERT(iter != server_sockets_.end());
513 // Skip if the socket serving this allocation is UDP, as this will be shared 512 // Skip if the socket serving this allocation is UDP, as this will be shared
514 // by all allocations. 513 // by all allocations.
515 if (iter->second != cricket::PROTO_UDP) { 514 // Note: We may not find a socket if it's a TCP socket that was closed, and
515 // the allocation is only now timing out.
516 if (iter != server_sockets_.end() && iter->second != cricket::PROTO_UDP) {
516 DestroyInternalSocket(socket); 517 DestroyInternalSocket(socket);
517 } 518 }
518 519
519 AllocationMap::iterator it = allocations_.find(*(allocation->conn())); 520 AllocationMap::iterator it = allocations_.find(*(allocation->conn()));
520 if (it != allocations_.end()) 521 if (it != allocations_.end())
521 allocations_.erase(it); 522 allocations_.erase(it);
522 } 523 }
523 524
524 void TurnServer::DestroyInternalSocket(rtc::AsyncPacketSocket* socket) { 525 void TurnServer::DestroyInternalSocket(rtc::AsyncPacketSocket* socket) {
525 InternalSocketMap::iterator iter = server_sockets_.find(socket); 526 InternalSocketMap::iterator iter = server_sockets_.find(socket);
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 MSG_ALLOCATION_TIMEOUT); 954 MSG_ALLOCATION_TIMEOUT);
954 } 955 }
955 956
956 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) { 957 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) {
957 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT); 958 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT);
958 SignalDestroyed(this); 959 SignalDestroyed(this);
959 delete this; 960 delete this;
960 } 961 }
961 962
962 } // namespace cricket 963 } // namespace cricket
OLDNEW
« webrtc/base/virtualsocketserver.cc ('K') | « webrtc/p2p/base/turnport_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698