Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2012 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 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 911 entry->SignalDestroyed(entry); | 911 entry->SignalDestroyed(entry); |
| 912 entries_.remove(entry); | 912 entries_.remove(entry); |
| 913 delete entry; | 913 delete entry; |
| 914 } | 914 } |
| 915 | 915 |
| 916 void TurnPort::OnConnectionDestroyed(Connection* conn) { | 916 void TurnPort::OnConnectionDestroyed(Connection* conn) { |
| 917 // Destroying TurnEntry for the connection, which is already destroyed. | 917 // Destroying TurnEntry for the connection, which is already destroyed. |
| 918 DestroyEntry(conn->remote_candidate().address()); | 918 DestroyEntry(conn->remote_candidate().address()); |
| 919 } | 919 } |
| 920 | 920 |
| 921 void TurnPort::OnCreatePermissionError(const rtc::SocketAddress address, | |
| 922 int code) { | |
| 923 Connection* c = GetConnection(address); | |
| 924 if (c) { | |
| 925 LOG_J(LS_ERROR, c) << "Received TURN CreatePermission error response, " | |
| 926 << "code=" << code << "; killing connection."; | |
| 927 c->set_state(Connection::STATE_FAILED); | |
| 928 c->Destroy(); | |
|
pthatcher
2015/11/24 17:56:47
Why does this need to be friend class?
| |
| 929 } | |
| 930 } | |
| 931 | |
| 921 TurnAllocateRequest::TurnAllocateRequest(TurnPort* port) | 932 TurnAllocateRequest::TurnAllocateRequest(TurnPort* port) |
| 922 : StunRequest(new TurnMessage()), | 933 : StunRequest(new TurnMessage()), |
| 923 port_(port) { | 934 port_(port) { |
| 924 } | 935 } |
| 925 | 936 |
| 926 void TurnAllocateRequest::Prepare(StunMessage* request) { | 937 void TurnAllocateRequest::Prepare(StunMessage* request) { |
| 927 // Create the request as indicated in RFC 5766, Section 6.1. | 938 // Create the request as indicated in RFC 5766, Section 6.1. |
| 928 request->SetType(TURN_ALLOCATE_REQUEST); | 939 request->SetType(TURN_ALLOCATE_REQUEST); |
| 929 StunUInt32Attribute* transport_attr = StunAttribute::CreateUInt32( | 940 StunUInt32Attribute* transport_attr = StunAttribute::CreateUInt32( |
| 930 STUN_ATTR_REQUESTED_TRANSPORT); | 941 STUN_ATTR_REQUESTED_TRANSPORT); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1340 } | 1351 } |
| 1341 | 1352 |
| 1342 void TurnEntry::OnCreatePermissionError(StunMessage* response, int code) { | 1353 void TurnEntry::OnCreatePermissionError(StunMessage* response, int code) { |
| 1343 if (code == STUN_ERROR_STALE_NONCE) { | 1354 if (code == STUN_ERROR_STALE_NONCE) { |
| 1344 if (port_->UpdateNonce(response)) { | 1355 if (port_->UpdateNonce(response)) { |
| 1345 SendCreatePermissionRequest(); | 1356 SendCreatePermissionRequest(); |
| 1346 } | 1357 } |
| 1347 } else { | 1358 } else { |
| 1348 // Send signal with error code. | 1359 // Send signal with error code. |
| 1349 port_->SignalCreatePermissionResult(port_, ext_addr_, code); | 1360 port_->SignalCreatePermissionResult(port_, ext_addr_, code); |
| 1361 port_->OnCreatePermissionError(ext_addr_, code); | |
| 1350 } | 1362 } |
| 1351 } | 1363 } |
| 1352 | 1364 |
| 1353 void TurnEntry::OnChannelBindSuccess() { | 1365 void TurnEntry::OnChannelBindSuccess() { |
| 1354 LOG_J(LS_INFO, port_) << "Channel bind for " << ext_addr_.ToSensitiveString() | 1366 LOG_J(LS_INFO, port_) << "Channel bind for " << ext_addr_.ToSensitiveString() |
| 1355 << " succeeded"; | 1367 << " succeeded"; |
| 1356 ASSERT(state_ == STATE_BINDING || state_ == STATE_BOUND); | 1368 ASSERT(state_ == STATE_BINDING || state_ == STATE_BOUND); |
| 1357 state_ = STATE_BOUND; | 1369 state_ = STATE_BOUND; |
| 1358 } | 1370 } |
| 1359 | 1371 |
| 1360 void TurnEntry::OnChannelBindError(StunMessage* response, int code) { | 1372 void TurnEntry::OnChannelBindError(StunMessage* response, int code) { |
| 1361 // TODO(mallinath) - Implement handling of error response for channel | 1373 // TODO(mallinath) - Implement handling of error response for channel |
| 1362 // bind request as per http://tools.ietf.org/html/rfc5766#section-11.3 | 1374 // bind request as per http://tools.ietf.org/html/rfc5766#section-11.3 |
| 1363 if (code == STUN_ERROR_STALE_NONCE) { | 1375 if (code == STUN_ERROR_STALE_NONCE) { |
| 1364 if (port_->UpdateNonce(response)) { | 1376 if (port_->UpdateNonce(response)) { |
| 1365 // Send channel bind request with fresh nonce. | 1377 // Send channel bind request with fresh nonce. |
| 1366 SendChannelBindRequest(0); | 1378 SendChannelBindRequest(0); |
| 1367 } | 1379 } |
| 1368 } | 1380 } |
| 1369 } | 1381 } |
| 1370 | 1382 |
| 1371 } // namespace cricket | 1383 } // namespace cricket |
| OLD | NEW |