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