| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 socket_->SetOption(iter->first, iter->second); | 344 socket_->SetOption(iter->first, iter->second); |
| 345 } | 345 } |
| 346 | 346 |
| 347 if (!SharedSocket()) { | 347 if (!SharedSocket()) { |
| 348 // If socket is shared, AllocationSequence will receive the packet. | 348 // If socket is shared, AllocationSequence will receive the packet. |
| 349 socket_->SignalReadPacket.connect(this, &TurnPort::OnReadPacket); | 349 socket_->SignalReadPacket.connect(this, &TurnPort::OnReadPacket); |
| 350 } | 350 } |
| 351 | 351 |
| 352 socket_->SignalReadyToSend.connect(this, &TurnPort::OnReadyToSend); | 352 socket_->SignalReadyToSend.connect(this, &TurnPort::OnReadyToSend); |
| 353 | 353 |
| 354 socket_->SignalSentPacket.connect(this, &TurnPort::OnSentPacket); |
| 355 |
| 354 // TCP port is ready to send stun requests after the socket is connected, | 356 // TCP port is ready to send stun requests after the socket is connected, |
| 355 // while UDP port is ready to do so once the socket is created. | 357 // while UDP port is ready to do so once the socket is created. |
| 356 if (server_address_.proto == PROTO_TCP) { | 358 if (server_address_.proto == PROTO_TCP) { |
| 357 socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect); | 359 socket_->SignalConnect.connect(this, &TurnPort::OnSocketConnect); |
| 358 socket_->SignalClose.connect(this, &TurnPort::OnSocketClose); | 360 socket_->SignalClose.connect(this, &TurnPort::OnSocketClose); |
| 359 } else { | 361 } else { |
| 360 state_ = STATE_CONNECTED; | 362 state_ = STATE_CONNECTED; |
| 361 } | 363 } |
| 362 return true; | 364 return true; |
| 363 } | 365 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 if (IsStunSuccessResponseType(msg_type) && | 577 if (IsStunSuccessResponseType(msg_type) && |
| 576 !StunMessage::ValidateMessageIntegrity(data, size, hash())) { | 578 !StunMessage::ValidateMessageIntegrity(data, size, hash())) { |
| 577 LOG_J(LS_WARNING, this) << "Received TURN message with invalid " | 579 LOG_J(LS_WARNING, this) << "Received TURN message with invalid " |
| 578 << "message integrity, msg_type=" << msg_type; | 580 << "message integrity, msg_type=" << msg_type; |
| 579 return; | 581 return; |
| 580 } | 582 } |
| 581 request_manager_.CheckResponse(data, size); | 583 request_manager_.CheckResponse(data, size); |
| 582 } | 584 } |
| 583 } | 585 } |
| 584 | 586 |
| 587 void TurnPort::OnSentPacket(rtc::AsyncPacketSocket* socket, |
| 588 const rtc::SentPacket& sent_packet) { |
| 589 PortInterface::SignalSentPacket(sent_packet); |
| 590 } |
| 591 |
| 585 void TurnPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { | 592 void TurnPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { |
| 586 if (ready()) { | 593 if (ready()) { |
| 587 Port::OnReadyToSend(); | 594 Port::OnReadyToSend(); |
| 588 } | 595 } |
| 589 } | 596 } |
| 590 | 597 |
| 591 | 598 |
| 592 // Update current server address port with the alternate server address port. | 599 // Update current server address port with the alternate server address port. |
| 593 bool TurnPort::SetAlternateServer(const rtc::SocketAddress& address) { | 600 bool TurnPort::SetAlternateServer(const rtc::SocketAddress& address) { |
| 594 // Check if we have seen this address before and reject if we did. | 601 // Check if we have seen this address before and reject if we did. |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 } else { | 1500 } else { |
| 1494 state_ = STATE_UNBOUND; | 1501 state_ = STATE_UNBOUND; |
| 1495 port_->DestroyConnection(ext_addr_); | 1502 port_->DestroyConnection(ext_addr_); |
| 1496 } | 1503 } |
| 1497 } | 1504 } |
| 1498 void TurnEntry::OnChannelBindTimeout() { | 1505 void TurnEntry::OnChannelBindTimeout() { |
| 1499 state_ = STATE_UNBOUND; | 1506 state_ = STATE_UNBOUND; |
| 1500 port_->DestroyConnection(ext_addr_); | 1507 port_->DestroyConnection(ext_addr_); |
| 1501 } | 1508 } |
| 1502 } // namespace cricket | 1509 } // namespace cricket |
| OLD | NEW |