OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 if (!SharedSocket()) { | 203 if (!SharedSocket()) { |
204 ASSERT(socket_ == NULL); | 204 ASSERT(socket_ == NULL); |
205 socket_ = socket_factory()->CreateUdpSocket( | 205 socket_ = socket_factory()->CreateUdpSocket( |
206 rtc::SocketAddress(ip(), 0), min_port(), max_port()); | 206 rtc::SocketAddress(ip(), 0), min_port(), max_port()); |
207 if (!socket_) { | 207 if (!socket_) { |
208 LOG_J(LS_WARNING, this) << "UDP socket creation failed"; | 208 LOG_J(LS_WARNING, this) << "UDP socket creation failed"; |
209 return false; | 209 return false; |
210 } | 210 } |
211 socket_->SignalReadPacket.connect(this, &UDPPort::OnReadPacket); | 211 socket_->SignalReadPacket.connect(this, &UDPPort::OnReadPacket); |
212 } | 212 } |
| 213 socket_->SignalSentPacket.connect(this, &UDPPort::OnSentPacket); |
213 socket_->SignalReadyToSend.connect(this, &UDPPort::OnReadyToSend); | 214 socket_->SignalReadyToSend.connect(this, &UDPPort::OnReadyToSend); |
214 socket_->SignalAddressReady.connect(this, &UDPPort::OnLocalAddressReady); | 215 socket_->SignalAddressReady.connect(this, &UDPPort::OnLocalAddressReady); |
215 requests_.SignalSendPacket.connect(this, &UDPPort::OnSendPacket); | 216 requests_.SignalSendPacket.connect(this, &UDPPort::OnSendPacket); |
216 return true; | 217 return true; |
217 } | 218 } |
218 | 219 |
219 UDPPort::~UDPPort() { | 220 UDPPort::~UDPPort() { |
220 if (!SharedSocket()) | 221 if (!SharedSocket()) |
221 delete socket_; | 222 delete socket_; |
222 } | 223 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 return; | 316 return; |
316 } | 317 } |
317 | 318 |
318 if (Connection* conn = GetConnection(remote_addr)) { | 319 if (Connection* conn = GetConnection(remote_addr)) { |
319 conn->OnReadPacket(data, size, packet_time); | 320 conn->OnReadPacket(data, size, packet_time); |
320 } else { | 321 } else { |
321 Port::OnReadPacket(data, size, remote_addr, PROTO_UDP); | 322 Port::OnReadPacket(data, size, remote_addr, PROTO_UDP); |
322 } | 323 } |
323 } | 324 } |
324 | 325 |
| 326 void UDPPort::OnSentPacket(rtc::AsyncPacketSocket* socket, |
| 327 const rtc::SentPacket& sent_packet) { |
| 328 Port::OnSentPacket(sent_packet); |
| 329 } |
| 330 |
325 void UDPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { | 331 void UDPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { |
326 Port::OnReadyToSend(); | 332 Port::OnReadyToSend(); |
327 } | 333 } |
328 | 334 |
329 void UDPPort::SendStunBindingRequests() { | 335 void UDPPort::SendStunBindingRequests() { |
330 // We will keep pinging the stun server to make sure our NAT pin-hole stays | 336 // We will keep pinging the stun server to make sure our NAT pin-hole stays |
331 // open during the call. | 337 // open during the call. |
332 ASSERT(requests_.empty()); | 338 ASSERT(requests_.empty()); |
333 | 339 |
334 for (ServerAddresses::const_iterator it = server_addresses_.begin(); | 340 for (ServerAddresses::const_iterator it = server_addresses_.begin(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 const std::vector<Candidate>& existing_candidates = Candidates(); | 469 const std::vector<Candidate>& existing_candidates = Candidates(); |
464 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); | 470 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); |
465 for (; it != existing_candidates.end(); ++it) { | 471 for (; it != existing_candidates.end(); ++it) { |
466 if (it->address() == addr) | 472 if (it->address() == addr) |
467 return true; | 473 return true; |
468 } | 474 } |
469 return false; | 475 return false; |
470 } | 476 } |
471 | 477 |
472 } // namespace cricket | 478 } // namespace cricket |
OLD | NEW |