Index: webrtc/p2p/base/turnport.cc |
diff --git a/webrtc/p2p/base/turnport.cc b/webrtc/p2p/base/turnport.cc |
index 3fdcac5f31b5804d094d8fe6e8a5891f7a8dd94e..b8360c31d494c50d7f0ec97c356a7f95c48e13b2 100644 |
--- a/webrtc/p2p/base/turnport.cc |
+++ b/webrtc/p2p/base/turnport.cc |
@@ -445,7 +445,7 @@ Connection* TurnPort::CreateConnection(const Candidate& address, |
// and TURN candidate later. |
for (size_t index = 0; index < Candidates().size(); ++index) { |
if (Candidates()[index].type() == RELAY_PORT_TYPE) { |
- ProxyConnection* conn = new ProxyConnection(this, index, address); |
+ TurnConnection* conn = new TurnConnection(this, index, address); |
conn->SignalDestroyed.connect(this, &TurnPort::OnConnectionDestroyed); |
AddConnection(conn); |
return conn; |
@@ -1368,4 +1368,30 @@ void TurnEntry::OnChannelBindError(StunMessage* response, int code) { |
} |
} |
+TurnConnection::TurnConnection(TurnPort* port, |
+ size_t index, |
+ const Candidate& remote_candidate) |
+ : ProxyConnection(port, index, remote_candidate), turn_port_(port) { |
+ turn_port_->SignalCreatePermissionResult.connect( |
+ this, &TurnConnection::OnCreatePermissionResult); |
+} |
+ |
+TurnConnection::~TurnConnection() { |
+ turn_port_->SignalCreatePermissionResult.disconnect(this); |
+} |
+ |
+void TurnConnection::OnCreatePermissionResult( |
+ TurnPort* port, |
+ const rtc::SocketAddress& remote_address, |
+ int code) { |
+ RTC_DCHECK(port == turn_port_); |
+ if (remote_address != remote_candidate_.address() || code == 0) { |
+ return; |
+ } |
+ LOG_J(LS_ERROR, this) << "Received TURN CreatePermission error response, " |
+ << "code=" << code << "; killing connection."; |
+ set_state(STATE_FAILED); |
+ Destroy(); |
+} |
+ |
} // namespace cricket |