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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 Close(); | 231 Close(); |
232 return false; | 232 return false; |
233 } | 233 } |
234 return true; | 234 return true; |
235 } | 235 } |
236 | 236 |
237 void PeerConnectionClient::OnConnect(rtc::AsyncSocket* socket) { | 237 void PeerConnectionClient::OnConnect(rtc::AsyncSocket* socket) { |
238 RTC_DCHECK(!onconnect_data_.empty()); | 238 RTC_DCHECK(!onconnect_data_.empty()); |
239 size_t sent = socket->Send(onconnect_data_.c_str(), onconnect_data_.length()); | 239 size_t sent = socket->Send(onconnect_data_.c_str(), onconnect_data_.length()); |
240 RTC_DCHECK(sent == onconnect_data_.length()); | 240 RTC_DCHECK(sent == onconnect_data_.length()); |
241 RTC_UNUSED(sent); | |
242 onconnect_data_.clear(); | 241 onconnect_data_.clear(); |
243 } | 242 } |
244 | 243 |
245 void PeerConnectionClient::OnHangingGetConnect(rtc::AsyncSocket* socket) { | 244 void PeerConnectionClient::OnHangingGetConnect(rtc::AsyncSocket* socket) { |
246 char buffer[1024]; | 245 char buffer[1024]; |
247 sprintfn(buffer, sizeof(buffer), | 246 sprintfn(buffer, sizeof(buffer), |
248 "GET /wait?peer_id=%i HTTP/1.0\r\n\r\n", my_id_); | 247 "GET /wait?peer_id=%i HTTP/1.0\r\n\r\n", my_id_); |
249 int len = static_cast<int>(strlen(buffer)); | 248 int len = static_cast<int>(strlen(buffer)); |
250 int sent = socket->Send(buffer, len); | 249 int sent = socket->Send(buffer, len); |
251 RTC_DCHECK(sent == len); | 250 RTC_DCHECK(sent == len); |
252 RTC_UNUSED2(sent, len); | |
253 } | 251 } |
254 | 252 |
255 void PeerConnectionClient::OnMessageFromPeer(int peer_id, | 253 void PeerConnectionClient::OnMessageFromPeer(int peer_id, |
256 const std::string& message) { | 254 const std::string& message) { |
257 if (message.length() == (sizeof(kByeMessage) - 1) && | 255 if (message.length() == (sizeof(kByeMessage) - 1) && |
258 message.compare(kByeMessage) == 0) { | 256 message.compare(kByeMessage) == 0) { |
259 callback_->OnPeerDisconnected(peer_id); | 257 callback_->OnPeerDisconnected(peer_id); |
260 } else { | 258 } else { |
261 callback_->OnMessageFromPeer(peer_id, message); | 259 callback_->OnMessageFromPeer(peer_id, message); |
262 } | 260 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 Close(); | 504 Close(); |
507 callback_->OnDisconnected(); | 505 callback_->OnDisconnected(); |
508 } | 506 } |
509 } | 507 } |
510 } | 508 } |
511 | 509 |
512 void PeerConnectionClient::OnMessage(rtc::Message* msg) { | 510 void PeerConnectionClient::OnMessage(rtc::Message* msg) { |
513 // ignore msg; there is currently only one supported message ("retry") | 511 // ignore msg; there is currently only one supported message ("retry") |
514 DoConnect(); | 512 DoConnect(); |
515 } | 513 } |
OLD | NEW |