Files
platform-external-webrtc/webrtc/p2p/base/transportchannel.cc
Guo-wei Shieh be508a1d36 Implement Tcp Reconnect for TCPPort.
UDP case should not be changed.

Active TCPConnection will initiate Reconnect after OnClose and when Send or Ping fails.
Passive TCPConnection will prune itself as usual as the active side will create a new connection.

The Reconnect could make P2PCT choose a different best_connection in the case where connectivities exist b/w more than 1 Network.

Also, to avoid upper layer triggers ice restart, the WRITE_TIMEOUT caused by the socket disconnection is delayed  to give the reconnect mechanism chance to kick in. The timeout event is only fired if the reconnect can't work in 5 sec. If the reconnect, there should be no ICE disconnected state trigger either in active or passive side.

BUG=1926
R=pthatcher@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/31359004

Cr-Commit-Position: refs/heads/master@{#8929}
2015-04-06 19:48:53 +00:00

47 lines
1.3 KiB
C++

/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <sstream>
#include "webrtc/p2p/base/common.h"
#include "webrtc/p2p/base/transportchannel.h"
namespace cricket {
std::string TransportChannel::ToString() const {
const char READABLE_ABBREV[2] = { '_', 'R' };
const char WRITABLE_ABBREV[2] = { '_', 'W' };
std::stringstream ss;
ss << "Channel[" << content_name_
<< "|" << component_
<< "|" << READABLE_ABBREV[readable_] << WRITABLE_ABBREV[writable_] << "]";
return ss.str();
}
void TransportChannel::set_readable(bool readable) {
if (readable_ != readable) {
readable_ = readable;
SignalReadableState(this);
}
}
void TransportChannel::set_writable(bool writable) {
if (writable_ != writable) {
LOG_J(LS_VERBOSE, this) << "set_writable from:" << writable_ << " to "
<< writable;
writable_ = writable;
if (writable_) {
SignalReadyToSend(this);
}
SignalWritableState(this);
}
}
} // namespace cricket