| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 Destroy(); | 122 Destroy(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void ProxyBinding::Read(AsyncSocket* socket, FifoBuffer* buffer) { | 125 void ProxyBinding::Read(AsyncSocket* socket, FifoBuffer* buffer) { |
| 126 // Only read if the buffer is empty. | 126 // Only read if the buffer is empty. |
| 127 ASSERT(socket != NULL); | 127 ASSERT(socket != NULL); |
| 128 size_t size; | 128 size_t size; |
| 129 int read; | 129 int read; |
| 130 if (buffer->GetBuffered(&size) && size == 0) { | 130 if (buffer->GetBuffered(&size) && size == 0) { |
| 131 void* p = buffer->GetWriteBuffer(&size); | 131 void* p = buffer->GetWriteBuffer(&size); |
| 132 read = socket->Recv(p, size); | 132 read = socket->Recv(p, size, nullptr); |
| 133 buffer->ConsumeWriteBuffer(std::max(read, 0)); | 133 buffer->ConsumeWriteBuffer(std::max(read, 0)); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ProxyBinding::Write(AsyncSocket* socket, FifoBuffer* buffer) { | 137 void ProxyBinding::Write(AsyncSocket* socket, FifoBuffer* buffer) { |
| 138 ASSERT(socket != NULL); | 138 ASSERT(socket != NULL); |
| 139 size_t size; | 139 size_t size; |
| 140 int written; | 140 int written; |
| 141 const void* p = buffer->GetReadData(&size); | 141 const void* p = buffer->GetReadData(&size); |
| 142 written = socket->Send(p, size); | 142 written = socket->Send(p, size); |
| 143 buffer->ConsumeReadData(std::max(written, 0)); | 143 buffer->ConsumeReadData(std::max(written, 0)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void ProxyBinding::Destroy() { | 146 void ProxyBinding::Destroy() { |
| 147 SignalDestroyed(this); | 147 SignalDestroyed(this); |
| 148 } | 148 } |
| 149 | 149 |
| 150 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) { | 150 AsyncProxyServerSocket* SocksProxyServer::WrapSocket(AsyncSocket* socket) { |
| 151 return new AsyncSocksProxyServerSocket(socket); | 151 return new AsyncSocksProxyServerSocket(socket); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace rtc | 154 } // namespace rtc |
| OLD | NEW |