Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: webrtc/p2p/base/turnport.cc

Issue 1577873003: Connect TurnPort and TCPPort to AsyncPacketSocket::SignalSentPacket. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Improve comments. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/turnport.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « webrtc/p2p/base/turnport.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698