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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 new_socket->SignalReadEvent(new_socket); | 201 new_socket->SignalReadEvent(new_socket); |
202 } else { | 202 } else { |
203 size_t total_recv = 0; | 203 size_t total_recv = 0; |
204 while (true) { | 204 while (true) { |
205 size_t free_size = inbuf_.capacity() - inbuf_.size(); | 205 size_t free_size = inbuf_.capacity() - inbuf_.size(); |
206 if (free_size < kMinimumRecvSize && inbuf_.capacity() < max_insize_) { | 206 if (free_size < kMinimumRecvSize && inbuf_.capacity() < max_insize_) { |
207 inbuf_.EnsureCapacity(std::min(max_insize_, inbuf_.capacity() * 2)); | 207 inbuf_.EnsureCapacity(std::min(max_insize_, inbuf_.capacity() * 2)); |
208 free_size = inbuf_.capacity() - inbuf_.size(); | 208 free_size = inbuf_.capacity() - inbuf_.size(); |
209 } | 209 } |
210 | 210 |
211 int len = socket_->Recv(inbuf_.data() + inbuf_.size(), free_size); | 211 int len = |
| 212 socket_->Recv(inbuf_.data() + inbuf_.size(), free_size, nullptr); |
212 if (len < 0) { | 213 if (len < 0) { |
213 // TODO(stefan): Do something better like forwarding the error to the | 214 // TODO(stefan): Do something better like forwarding the error to the |
214 // user. | 215 // user. |
215 if (!socket_->IsBlocking()) { | 216 if (!socket_->IsBlocking()) { |
216 LOG(LS_ERROR) << "Recv() returned error: " << socket_->GetError(); | 217 LOG(LS_ERROR) << "Recv() returned error: " << socket_->GetError(); |
217 } | 218 } |
218 break; | 219 break; |
219 } | 220 } |
220 | 221 |
221 total_recv += len; | 222 total_recv += len; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 memmove(data, data + kPacketLenSize + pkt_len, *len); | 323 memmove(data, data + kPacketLenSize + pkt_len, *len); |
323 } | 324 } |
324 } | 325 } |
325 } | 326 } |
326 | 327 |
327 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { | 328 void AsyncTCPSocket::HandleIncomingConnection(AsyncSocket* socket) { |
328 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); | 329 SignalNewConnection(this, new AsyncTCPSocket(socket, false)); |
329 } | 330 } |
330 | 331 |
331 } // namespace rtc | 332 } // namespace rtc |
OLD | NEW |