OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 server_socket_->SignalReadEvent.connect(this, &ProxyServer::OnAcceptEvent); | 29 server_socket_->SignalReadEvent.connect(this, &ProxyServer::OnAcceptEvent); |
30 } | 30 } |
31 | 31 |
32 ProxyServer::~ProxyServer() { | 32 ProxyServer::~ProxyServer() { |
33 for (BindingList::iterator it = bindings_.begin(); | 33 for (BindingList::iterator it = bindings_.begin(); |
34 it != bindings_.end(); ++it) { | 34 it != bindings_.end(); ++it) { |
35 delete (*it); | 35 delete (*it); |
36 } | 36 } |
37 } | 37 } |
38 | 38 |
| 39 SocketAddress ProxyServer::GetServerAddress() { |
| 40 return server_socket_->GetLocalAddress(); |
| 41 } |
| 42 |
39 void ProxyServer::OnAcceptEvent(AsyncSocket* socket) { | 43 void ProxyServer::OnAcceptEvent(AsyncSocket* socket) { |
40 ASSERT(socket != NULL && socket == server_socket_.get()); | 44 ASSERT(socket != NULL && socket == server_socket_.get()); |
41 AsyncSocket* int_socket = socket->Accept(NULL); | 45 AsyncSocket* int_socket = socket->Accept(NULL); |
42 AsyncProxyServerSocket* wrapped_socket = WrapSocket(int_socket); | 46 AsyncProxyServerSocket* wrapped_socket = WrapSocket(int_socket); |
43 AsyncSocket* ext_socket = ext_factory_->CreateAsyncSocket(ext_ip_.family(), | 47 AsyncSocket* ext_socket = ext_factory_->CreateAsyncSocket(ext_ip_.family(), |
44 SOCK_STREAM); | 48 SOCK_STREAM); |
45 if (ext_socket) { | 49 if (ext_socket) { |
46 ext_socket->Bind(ext_ip_); | 50 ext_socket->Bind(ext_ip_); |
47 bindings_.push_back(new ProxyBinding(wrapped_socket, ext_socket)); | 51 bindings_.push_back(new ProxyBinding(wrapped_socket, ext_socket)); |
48 } else { | 52 } else { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 145 |
142 void ProxyBinding::Destroy() { | 146 void ProxyBinding::Destroy() { |
143 SignalDestroyed(this); | 147 SignalDestroyed(this); |
144 } | 148 } |
145 | 149 |
146 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) { | 150 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) { |
147 return new AsyncSocksProxyServerSocket(socket); | 151 return new AsyncSocksProxyServerSocket(socket); |
148 } | 152 } |
149 | 153 |
150 } // namespace rtc | 154 } // namespace rtc |
OLD | NEW |