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

Side by Side Diff: webrtc/rtc_base/proxyserver.cc

Issue 2988153003: Replace CHECK(x && y) with two separate CHECK() calls (Closed)
Patch Set: fix mistakes Created 3 years, 4 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/rtc_base/opensslstreamadapter.cc ('k') | webrtc/rtc_base/socketaddress.cc » ('j') | 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 25 matching lines...) Expand all
36 it != bindings_.end(); ++it) { 36 it != bindings_.end(); ++it) {
37 delete (*it); 37 delete (*it);
38 } 38 }
39 } 39 }
40 40
41 SocketAddress ProxyServer::GetServerAddress() { 41 SocketAddress ProxyServer::GetServerAddress() {
42 return server_socket_->GetLocalAddress(); 42 return server_socket_->GetLocalAddress();
43 } 43 }
44 44
45 void ProxyServer::OnAcceptEvent(AsyncSocket* socket) { 45 void ProxyServer::OnAcceptEvent(AsyncSocket* socket) {
46 RTC_DCHECK(socket != nullptr && socket == server_socket_.get()); 46 RTC_DCHECK(socket);
47 RTC_DCHECK_EQ(socket, server_socket_.get());
47 AsyncSocket* int_socket = socket->Accept(nullptr); 48 AsyncSocket* int_socket = socket->Accept(nullptr);
48 AsyncProxyServerSocket* wrapped_socket = WrapSocket(int_socket); 49 AsyncProxyServerSocket* wrapped_socket = WrapSocket(int_socket);
49 AsyncSocket* ext_socket = ext_factory_->CreateAsyncSocket(ext_ip_.family(), 50 AsyncSocket* ext_socket = ext_factory_->CreateAsyncSocket(ext_ip_.family(),
50 SOCK_STREAM); 51 SOCK_STREAM);
51 if (ext_socket) { 52 if (ext_socket) {
52 ext_socket->Bind(ext_ip_); 53 ext_socket->Bind(ext_ip_);
53 bindings_.push_back(new ProxyBinding(wrapped_socket, ext_socket)); 54 bindings_.push_back(new ProxyBinding(wrapped_socket, ext_socket));
54 } else { 55 } else {
55 LOG(LS_ERROR) << "Unable to create external socket on proxy accept event"; 56 LOG(LS_ERROR) << "Unable to create external socket on proxy accept event";
56 } 57 }
(...skipping 20 matching lines...) Expand all
77 &ProxyBinding::OnExternalConnect); 78 &ProxyBinding::OnExternalConnect);
78 ext_socket_->SignalReadEvent.connect(this, &ProxyBinding::OnExternalRead); 79 ext_socket_->SignalReadEvent.connect(this, &ProxyBinding::OnExternalRead);
79 ext_socket_->SignalWriteEvent.connect(this, &ProxyBinding::OnExternalWrite); 80 ext_socket_->SignalWriteEvent.connect(this, &ProxyBinding::OnExternalWrite);
80 ext_socket_->SignalCloseEvent.connect(this, &ProxyBinding::OnExternalClose); 81 ext_socket_->SignalCloseEvent.connect(this, &ProxyBinding::OnExternalClose);
81 } 82 }
82 83
83 ProxyBinding::~ProxyBinding() = default; 84 ProxyBinding::~ProxyBinding() = default;
84 85
85 void ProxyBinding::OnConnectRequest(AsyncProxyServerSocket* socket, 86 void ProxyBinding::OnConnectRequest(AsyncProxyServerSocket* socket,
86 const SocketAddress& addr) { 87 const SocketAddress& addr) {
87 RTC_DCHECK(!connected_ && ext_socket_.get() != nullptr); 88 RTC_DCHECK(!connected_);
89 RTC_DCHECK(ext_socket_);
88 ext_socket_->Connect(addr); 90 ext_socket_->Connect(addr);
89 // TODO: handle errors here 91 // TODO: handle errors here
90 } 92 }
91 93
92 void ProxyBinding::OnInternalRead(AsyncSocket* socket) { 94 void ProxyBinding::OnInternalRead(AsyncSocket* socket) {
93 Read(int_socket_.get(), &out_buffer_); 95 Read(int_socket_.get(), &out_buffer_);
94 Write(ext_socket_.get(), &out_buffer_); 96 Write(ext_socket_.get(), &out_buffer_);
95 } 97 }
96 98
97 void ProxyBinding::OnInternalWrite(AsyncSocket* socket) { 99 void ProxyBinding::OnInternalWrite(AsyncSocket* socket) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 149
148 void ProxyBinding::Destroy() { 150 void ProxyBinding::Destroy() {
149 SignalDestroyed(this); 151 SignalDestroyed(this);
150 } 152 }
151 153
152 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) { 154 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) {
153 return new AsyncSocksProxyServerSocket(socket); 155 return new AsyncSocksProxyServerSocket(socket);
154 } 156 }
155 157
156 } // namespace rtc 158 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/rtc_base/opensslstreamadapter.cc ('k') | webrtc/rtc_base/socketaddress.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698