| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2011 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 return NULL; | 113 return NULL; |
| 114 } | 114 } |
| 115 | 115 |
| 116 if (BindSocket(socket, local_address, 0, 0) < 0) { | 116 if (BindSocket(socket, local_address, 0, 0) < 0) { |
| 117 LOG(LS_ERROR) << "TCP bind failed with error " | 117 LOG(LS_ERROR) << "TCP bind failed with error " |
| 118 << socket->GetError(); | 118 << socket->GetError(); |
| 119 delete socket; | 119 delete socket; |
| 120 return NULL; | 120 return NULL; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // If using a proxy, wrap the socket in a proxy socket. | |
| 124 if (proxy_info.type == PROXY_SOCKS5) { | |
| 125 socket = new AsyncSocksProxySocket( | |
| 126 socket, proxy_info.address, proxy_info.username, proxy_info.password); | |
| 127 } else if (proxy_info.type == PROXY_HTTPS) { | |
| 128 socket = | |
| 129 new AsyncHttpsProxySocket(socket, user_agent, proxy_info.address, | |
| 130 proxy_info.username, proxy_info.password); | |
| 131 } | |
| 132 | |
| 133 // Assert that at most one TLS option is used. | 123 // Assert that at most one TLS option is used. |
| 134 int tlsOpts = | 124 int tlsOpts = |
| 135 opts & (PacketSocketFactory::OPT_TLS | PacketSocketFactory::OPT_TLS_FAKE | | 125 opts & (PacketSocketFactory::OPT_TLS | PacketSocketFactory::OPT_TLS_FAKE | |
| 136 PacketSocketFactory::OPT_TLS_INSECURE); | 126 PacketSocketFactory::OPT_TLS_INSECURE); |
| 137 RTC_DCHECK((tlsOpts & (tlsOpts - 1)) == 0); | 127 RTC_DCHECK((tlsOpts & (tlsOpts - 1)) == 0); |
| 138 | 128 |
| 139 if ((tlsOpts & PacketSocketFactory::OPT_TLS) || | 129 if ((tlsOpts & PacketSocketFactory::OPT_TLS) || |
| 140 (tlsOpts & PacketSocketFactory::OPT_TLS_INSECURE)) { | 130 (tlsOpts & PacketSocketFactory::OPT_TLS_INSECURE)) { |
| 141 // Using TLS, wrap the socket in an SSL adapter. | 131 // Using TLS, wrap the socket in an SSL adapter. |
| 142 SSLAdapter* ssl_adapter = SSLAdapter::Create(socket); | 132 SSLAdapter* ssl_adapter = SSLAdapter::Create(socket); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 SocketFactory* BasicPacketSocketFactory::socket_factory() { | 196 SocketFactory* BasicPacketSocketFactory::socket_factory() { |
| 207 if (thread_) { | 197 if (thread_) { |
| 208 RTC_DCHECK(thread_ == Thread::Current()); | 198 RTC_DCHECK(thread_ == Thread::Current()); |
| 209 return thread_->socketserver(); | 199 return thread_->socketserver(); |
| 210 } else { | 200 } else { |
| 211 return socket_factory_; | 201 return socket_factory_; |
| 212 } | 202 } |
| 213 } | 203 } |
| 214 | 204 |
| 215 } // namespace rtc | 205 } // namespace rtc |
| OLD | NEW |