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

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

Issue 1556743002: Bind a socket to a network if the network handle is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // For TCP and TLS AllcateRequest will be sent by OnSocketConnect. 312 // For TCP and TLS AllcateRequest will be sent by OnSocketConnect.
313 SendRequest(new TurnAllocateRequest(this), 0); 313 SendRequest(new TurnAllocateRequest(this), 0);
314 } 314 }
315 } 315 }
316 } 316 }
317 317
318 bool TurnPort::CreateTurnClientSocket() { 318 bool TurnPort::CreateTurnClientSocket() {
319 ASSERT(!socket_ || SharedSocket()); 319 ASSERT(!socket_ || SharedSocket());
320 320
321 if (server_address_.proto == PROTO_UDP && !SharedSocket()) { 321 if (server_address_.proto == PROTO_UDP && !SharedSocket()) {
322 socket_ = socket_factory()->CreateUdpSocket( 322 socket_ = socket_factory()->CreateUdpSocketOnNetwork(
323 rtc::SocketAddress(ip(), 0), min_port(), max_port()); 323 rtc::SocketAddress(ip(), 0), min_port(), max_port(), Network());
324 } else if (server_address_.proto == PROTO_TCP) { 324 } else if (server_address_.proto == PROTO_TCP) {
325 ASSERT(!SharedSocket()); 325 ASSERT(!SharedSocket());
326 int opts = rtc::PacketSocketFactory::OPT_STUN; 326 int opts = rtc::PacketSocketFactory::OPT_STUN;
327 // If secure bit is enabled in server address, use TLS over TCP. 327 // If secure bit is enabled in server address, use TLS over TCP.
328 if (server_address_.secure) { 328 if (server_address_.secure) {
329 opts |= rtc::PacketSocketFactory::OPT_TLS; 329 opts |= rtc::PacketSocketFactory::OPT_TLS;
330 } 330 }
331 socket_ = socket_factory()->CreateClientTcpSocket( 331 socket_ = socket_factory()->CreateClientTcpSocket(
332 rtc::SocketAddress(ip(), 0), server_address_.address, 332 rtc::SocketAddress(ip(), 0), server_address_.address,
333 proxy(), user_agent(), opts); 333 proxy(), user_agent(), opts);
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 } else { 1493 } else {
1494 state_ = STATE_UNBOUND; 1494 state_ = STATE_UNBOUND;
1495 port_->DestroyConnection(ext_addr_); 1495 port_->DestroyConnection(ext_addr_);
1496 } 1496 }
1497 } 1497 }
1498 void TurnEntry::OnChannelBindTimeout() { 1498 void TurnEntry::OnChannelBindTimeout() {
1499 state_ = STATE_UNBOUND; 1499 state_ = STATE_UNBOUND;
1500 port_->DestroyConnection(ext_addr_); 1500 port_->DestroyConnection(ext_addr_);
1501 } 1501 }
1502 } // namespace cricket 1502 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698