| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 348 } |
| 349 return sent; | 349 return sent; |
| 350 } | 350 } |
| 351 | 351 |
| 352 int TCPConnection::GetError() { | 352 int TCPConnection::GetError() { |
| 353 return error_; | 353 return error_; |
| 354 } | 354 } |
| 355 | 355 |
| 356 void TCPConnection::OnConnectionRequestResponse(ConnectionRequest* req, | 356 void TCPConnection::OnConnectionRequestResponse(ConnectionRequest* req, |
| 357 StunMessage* response) { | 357 StunMessage* response) { |
| 358 // Once we receive a binding response, we are really writable, and not just | 358 // Process the STUN response before we inform upper layer ready to send. |
| 359 // pretending to be writable. | 359 Connection::OnConnectionRequestResponse(req, response); |
| 360 |
| 361 // If we're in the state of pretending to be writeable, we should inform the |
| 362 // upper layer it's ready to send again as previous EWOULDLBLOCK from socket |
| 363 // would have stopped the outgoing stream. |
| 364 if (pretending_to_be_writable_) { |
| 365 Connection::OnReadyToSend(); |
| 366 } |
| 360 pretending_to_be_writable_ = false; | 367 pretending_to_be_writable_ = false; |
| 361 Connection::OnConnectionRequestResponse(req, response); | |
| 362 ASSERT(write_state() == STATE_WRITABLE); | 368 ASSERT(write_state() == STATE_WRITABLE); |
| 363 } | 369 } |
| 364 | 370 |
| 365 void TCPConnection::OnConnect(rtc::AsyncPacketSocket* socket) { | 371 void TCPConnection::OnConnect(rtc::AsyncPacketSocket* socket) { |
| 366 ASSERT(socket == socket_); | 372 ASSERT(socket == socket_); |
| 367 // Do not use this connection if the socket bound to a different address than | 373 // Do not use this connection if the socket bound to a different address than |
| 368 // the one we asked for. This is seen in Chrome, where TCP sockets cannot be | 374 // the one we asked for. This is seen in Chrome, where TCP sockets cannot be |
| 369 // given a binding address, and the platform is expected to pick the | 375 // given a binding address, and the platform is expected to pick the |
| 370 // correct local address. | 376 // correct local address. |
| 371 const rtc::IPAddress& socket_ip = socket->GetLocalAddress().ipaddr(); | 377 const rtc::IPAddress& socket_ip = socket->GetLocalAddress().ipaddr(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 474 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
| 469 if (outgoing_) { | 475 if (outgoing_) { |
| 470 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 476 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
| 471 } | 477 } |
| 472 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 478 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
| 473 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 479 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
| 474 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 480 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
| 475 } | 481 } |
| 476 | 482 |
| 477 } // namespace cricket | 483 } // namespace cricket |
| OLD | NEW |