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

Side by Side Diff: webrtc/base/natsocketfactory.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 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 socket_->SignalCloseEvent.connect(this, &NATSocket::OnCloseEvent); 102 socket_->SignalCloseEvent.connect(this, &NATSocket::OnCloseEvent);
103 } else { 103 } else {
104 server_addr_.Clear(); 104 server_addr_.Clear();
105 delete socket_; 105 delete socket_;
106 socket_ = NULL; 106 socket_ = NULL;
107 } 107 }
108 108
109 return result; 109 return result;
110 } 110 }
111 111
112 int BindToNetwork(NetworkHandle net_handle) override { return 0; }
113
112 int Connect(const SocketAddress& addr) override { 114 int Connect(const SocketAddress& addr) override {
113 if (!socket_) { // socket must be bound, for now 115 if (!socket_) { // socket must be bound, for now
114 return -1; 116 return -1;
115 } 117 }
116 118
117 int result = 0; 119 int result = 0;
118 if (type_ == SOCK_STREAM) { 120 if (type_ == SOCK_STREAM) {
119 result = socket_->Connect(server_addr_.IsNil() ? addr : server_addr_); 121 result = socket_->Connect(server_addr_.IsNil() ? addr : server_addr_);
120 } else { 122 } else {
121 connected_ = true; 123 connected_ = true;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 NATSocketServer::Translator* NATSocketServer::TranslatorMap::FindClient( 496 NATSocketServer::Translator* NATSocketServer::TranslatorMap::FindClient(
495 const SocketAddress& int_ip) { 497 const SocketAddress& int_ip) {
496 Translator* nat = NULL; 498 Translator* nat = NULL;
497 for (TranslatorMap::iterator it = begin(); it != end() && !nat; ++it) { 499 for (TranslatorMap::iterator it = begin(); it != end() && !nat; ++it) {
498 nat = it->second->FindClient(int_ip); 500 nat = it->second->FindClient(int_ip);
499 } 501 }
500 return nat; 502 return nat;
501 } 503 }
502 504
503 } // namespace rtc 505 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698