diff options
author | deadbeef <deadbeef@webrtc.org> | 2015-11-25 09:00:08 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-25 17:00:12 +0000 |
commit | 376e1235c7b602e86afe9f36eb81289e42643718 (patch) | |
tree | 10a969295a5b63b14c7d0341ca1dc95bcaf157ad /webrtc/p2p/base/port.cc | |
parent | 13725089ef91f932b37b2447c3f05d9cd9f89984 (diff) | |
download | webrtc-376e1235c7b602e86afe9f36eb81289e42643718.tar.gz |
Destroy a Connection if a CreatePermission request fails.
This means that if a TURN server denies permission for an
unreachable address, we'll no longer ping it fruitlessly.
BUG=webrtc:4917
Review URL: https://codereview.webrtc.org/1415313004
Cr-Commit-Position: refs/heads/master@{#10789}
Diffstat (limited to 'webrtc/p2p/base/port.cc')
-rw-r--r-- | webrtc/p2p/base/port.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/webrtc/p2p/base/port.cc b/webrtc/p2p/base/port.cc index 90275aa141..ddf38dcb18 100644 --- a/webrtc/p2p/base/port.cc +++ b/webrtc/p2p/base/port.cc @@ -1008,6 +1008,11 @@ void Connection::Destroy() { port_->thread()->Post(this, MSG_DELETE); } +void Connection::FailAndDestroy() { + set_state(Connection::STATE_FAILED); + Destroy(); +} + void Connection::PrintPingsSinceLastResponse(std::string* s, size_t max) { std::ostringstream oss; oss << std::boolalpha; @@ -1242,8 +1247,7 @@ void Connection::OnConnectionRequestErrorResponse(ConnectionRequest* request, // This is not a valid connection. LOG_J(LS_ERROR, this) << "Received STUN error response, code=" << error_code << "; killing connection"; - set_state(STATE_FAILED); - Destroy(); + FailAndDestroy(); } } @@ -1390,10 +1394,10 @@ void Connection::MaybeAddPrflxCandidate(ConnectionRequest* request, SignalStateChange(this); } -ProxyConnection::ProxyConnection(Port* port, size_t index, - const Candidate& candidate) - : Connection(port, index, candidate), error_(0) { -} +ProxyConnection::ProxyConnection(Port* port, + size_t index, + const Candidate& remote_candidate) + : Connection(port, index, remote_candidate) {} int ProxyConnection::Send(const void* data, size_t size, const rtc::PacketOptions& options) { |