OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 return true; | 289 return true; |
290 } | 290 } |
291 return false; | 291 return false; |
292 } | 292 } |
293 | 293 |
294 bool PeerConnectionClient::ReadIntoBuffer(rtc::AsyncSocket* socket, | 294 bool PeerConnectionClient::ReadIntoBuffer(rtc::AsyncSocket* socket, |
295 std::string* data, | 295 std::string* data, |
296 size_t* content_length) { | 296 size_t* content_length) { |
297 char buffer[0xffff]; | 297 char buffer[0xffff]; |
298 do { | 298 do { |
299 int bytes = socket->Recv(buffer, sizeof(buffer)); | 299 int bytes = socket->Recv(buffer, sizeof(buffer), nullptr); |
300 if (bytes <= 0) | 300 if (bytes <= 0) |
301 break; | 301 break; |
302 data->append(buffer, bytes); | 302 data->append(buffer, bytes); |
303 } while (true); | 303 } while (true); |
304 | 304 |
305 bool ret = false; | 305 bool ret = false; |
306 size_t i = data->find("\r\n\r\n"); | 306 size_t i = data->find("\r\n\r\n"); |
307 if (i != std::string::npos) { | 307 if (i != std::string::npos) { |
308 LOG(INFO) << "Headers received"; | 308 LOG(INFO) << "Headers received"; |
309 if (GetHeaderValue(*data, i, "\r\nContent-Length: ", content_length)) { | 309 if (GetHeaderValue(*data, i, "\r\nContent-Length: ", content_length)) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 Close(); | 505 Close(); |
506 callback_->OnDisconnected(); | 506 callback_->OnDisconnected(); |
507 } | 507 } |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 void PeerConnectionClient::OnMessage(rtc::Message* msg) { | 511 void PeerConnectionClient::OnMessage(rtc::Message* msg) { |
512 // ignore msg; there is currently only one supported message ("retry") | 512 // ignore msg; there is currently only one supported message ("retry") |
513 DoConnect(); | 513 DoConnect(); |
514 } | 514 } |
OLD | NEW |