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

Side by Side Diff: webrtc/p2p/client/basicportallocator.cc

Issue 1871693004: Fix AllocationSequence to handle the case when TurnPort stops using shared socket. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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/turnport_unittest.cc ('k') | 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 ASSERT(socket == udp_socket_.get()); 1073 ASSERT(socket == udp_socket_.get());
1074 1074
1075 bool turn_port_found = false; 1075 bool turn_port_found = false;
1076 1076
1077 // Try to find the TurnPort that matches the remote address. Note that the 1077 // Try to find the TurnPort that matches the remote address. Note that the
1078 // message could be a STUN binding response if the TURN server is also used as 1078 // message could be a STUN binding response if the TURN server is also used as
1079 // a STUN server. We don't want to parse every message here to check if it is 1079 // a STUN server. We don't want to parse every message here to check if it is
1080 // a STUN binding response, so we pass the message to TurnPort regardless of 1080 // a STUN binding response, so we pass the message to TurnPort regardless of
1081 // the message type. The TurnPort will just ignore the message since it will 1081 // the message type. The TurnPort will just ignore the message since it will
1082 // not find any request by transaction ID. 1082 // not find any request by transaction ID.
1083 for (std::vector<TurnPort*>::const_iterator it = turn_ports_.begin(); 1083 for (TurnPort* port : turn_ports_) {
1084 it != turn_ports_.end(); ++it) {
1085 TurnPort* port = *it;
1086 if (port->server_address().address == remote_addr) { 1084 if (port->server_address().address == remote_addr) {
1087 port->HandleIncomingPacket(socket, data, size, remote_addr, packet_time); 1085 if (port->HandleIncomingPacket(socket, data, size, remote_addr,
1086 packet_time)) {
1087 return;
1088 }
1088 turn_port_found = true; 1089 turn_port_found = true;
1089 break;
1090 } 1090 }
1091 } 1091 }
1092 1092
1093 if (udp_port_) { 1093 if (udp_port_) {
1094 const ServerAddresses& stun_servers = udp_port_->server_addresses(); 1094 const ServerAddresses& stun_servers = udp_port_->server_addresses();
1095 1095
1096 // Pass the packet to the UdpPort if there is no matching TurnPort, or if 1096 // Pass the packet to the UdpPort if there is no matching TurnPort, or if
1097 // the TURN server is also a STUN server. 1097 // the TURN server is also a STUN server.
1098 if (!turn_port_found || 1098 if (!turn_port_found ||
1099 stun_servers.find(remote_addr) != stun_servers.end()) { 1099 stun_servers.find(remote_addr) != stun_servers.end()) {
1100 udp_port_->HandleIncomingPacket( 1100 RTC_DCHECK(udp_port_->SharedSocket());
1101 socket, data, size, remote_addr, packet_time); 1101 udp_port_->HandleIncomingPacket(socket, data, size, remote_addr,
1102 packet_time);
1102 } 1103 }
1103 } 1104 }
1104 } 1105 }
1105 1106
1106 void AllocationSequence::OnPortDestroyed(PortInterface* port) { 1107 void AllocationSequence::OnPortDestroyed(PortInterface* port) {
1107 if (udp_port_ == port) { 1108 if (udp_port_ == port) {
1108 udp_port_ = NULL; 1109 udp_port_ = NULL;
1109 return; 1110 return;
1110 } 1111 }
1111 1112
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 ServerAddresses servers; 1185 ServerAddresses servers;
1185 for (size_t i = 0; i < relays.size(); ++i) { 1186 for (size_t i = 0; i < relays.size(); ++i) {
1186 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) { 1187 if (relays[i].type == turn_type && SupportsProtocol(relays[i], type)) {
1187 servers.insert(relays[i].ports.front().address); 1188 servers.insert(relays[i].ports.front().address);
1188 } 1189 }
1189 } 1190 }
1190 return servers; 1191 return servers;
1191 } 1192 }
1192 1193
1193 } // namespace cricket 1194 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnport_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698