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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 if (connected()) { | 427 if (connected()) { |
428 set_connected(false); | 428 set_connected(false); |
429 | 429 |
430 // Prevent the connection from being destroyed by redundant SignalClose | 430 // Prevent the connection from being destroyed by redundant SignalClose |
431 // events. | 431 // events. |
432 pretending_to_be_writable_ = true; | 432 pretending_to_be_writable_ = true; |
433 | 433 |
434 // We don't attempt reconnect right here. This is to avoid a case where the | 434 // We don't attempt reconnect right here. This is to avoid a case where the |
435 // shutdown is intentional and reconnect is not necessary. We only reconnect | 435 // shutdown is intentional and reconnect is not necessary. We only reconnect |
436 // when the connection is used to Send() or Ping(). | 436 // when the connection is used to Send() or Ping(). |
437 port()->thread()->PostDelayed(reconnection_timeout(), this, | 437 port()->thread()->PostDelayed(RTC_FROM_HERE, reconnection_timeout(), this, |
438 MSG_TCPCONNECTION_DELAYED_ONCLOSE); | 438 MSG_TCPCONNECTION_DELAYED_ONCLOSE); |
439 } else if (!pretending_to_be_writable_) { | 439 } else if (!pretending_to_be_writable_) { |
440 // OnClose could be called when the underneath socket times out during the | 440 // OnClose could be called when the underneath socket times out during the |
441 // initial connect() (i.e. |pretending_to_be_writable_| is false) . We have | 441 // initial connect() (i.e. |pretending_to_be_writable_| is false) . We have |
442 // to manually destroy here as this connection, as never connected, will not | 442 // to manually destroy here as this connection, as never connected, will not |
443 // be scheduled for ping to trigger destroy. | 443 // be scheduled for ping to trigger destroy. |
444 Destroy(); | 444 Destroy(); |
445 } | 445 } |
446 } | 446 } |
447 | 447 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
513 if (outgoing_) { | 513 if (outgoing_) { |
514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
515 } | 515 } |
516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
518 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 518 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
519 } | 519 } |
520 | 520 |
521 } // namespace cricket | 521 } // namespace cricket |
OLD | NEW |