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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (!SharedSocket()) { | 210 if (!SharedSocket()) { |
211 ASSERT(socket_ == NULL); | 211 ASSERT(socket_ == NULL); |
212 socket_ = socket_factory()->CreateUdpSocket( | 212 socket_ = socket_factory()->CreateUdpSocket( |
213 rtc::SocketAddress(ip(), 0), min_port(), max_port()); | 213 rtc::SocketAddress(ip(), 0), min_port(), max_port()); |
214 if (!socket_) { | 214 if (!socket_) { |
215 LOG_J(LS_WARNING, this) << "UDP socket creation failed"; | 215 LOG_J(LS_WARNING, this) << "UDP socket creation failed"; |
216 return false; | 216 return false; |
217 } | 217 } |
218 socket_->SignalReadPacket.connect(this, &UDPPort::OnReadPacket); | 218 socket_->SignalReadPacket.connect(this, &UDPPort::OnReadPacket); |
219 } | 219 } |
| 220 socket_->SignalSentPacket.connect(this, &UDPPort::OnSentPacket); |
220 socket_->SignalReadyToSend.connect(this, &UDPPort::OnReadyToSend); | 221 socket_->SignalReadyToSend.connect(this, &UDPPort::OnReadyToSend); |
221 socket_->SignalAddressReady.connect(this, &UDPPort::OnLocalAddressReady); | 222 socket_->SignalAddressReady.connect(this, &UDPPort::OnLocalAddressReady); |
222 requests_.SignalSendPacket.connect(this, &UDPPort::OnSendPacket); | 223 requests_.SignalSendPacket.connect(this, &UDPPort::OnSendPacket); |
223 return true; | 224 return true; |
224 } | 225 } |
225 | 226 |
226 UDPPort::~UDPPort() { | 227 UDPPort::~UDPPort() { |
227 if (!SharedSocket()) | 228 if (!SharedSocket()) |
228 delete socket_; | 229 delete socket_; |
229 } | 230 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 return; | 323 return; |
323 } | 324 } |
324 | 325 |
325 if (Connection* conn = GetConnection(remote_addr)) { | 326 if (Connection* conn = GetConnection(remote_addr)) { |
326 conn->OnReadPacket(data, size, packet_time); | 327 conn->OnReadPacket(data, size, packet_time); |
327 } else { | 328 } else { |
328 Port::OnReadPacket(data, size, remote_addr, PROTO_UDP); | 329 Port::OnReadPacket(data, size, remote_addr, PROTO_UDP); |
329 } | 330 } |
330 } | 331 } |
331 | 332 |
| 333 void UDPPort::OnSentPacket(rtc::AsyncPacketSocket* socket, |
| 334 const rtc::SentPacket& sent_packet) { |
| 335 Port::OnSentPacket(sent_packet); |
| 336 } |
| 337 |
332 void UDPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { | 338 void UDPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { |
333 Port::OnReadyToSend(); | 339 Port::OnReadyToSend(); |
334 } | 340 } |
335 | 341 |
336 void UDPPort::SendStunBindingRequests() { | 342 void UDPPort::SendStunBindingRequests() { |
337 // We will keep pinging the stun server to make sure our NAT pin-hole stays | 343 // We will keep pinging the stun server to make sure our NAT pin-hole stays |
338 // open during the call. | 344 // open during the call. |
339 ASSERT(requests_.empty()); | 345 ASSERT(requests_.empty()); |
340 | 346 |
341 for (ServerAddresses::const_iterator it = server_addresses_.begin(); | 347 for (ServerAddresses::const_iterator it = server_addresses_.begin(); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 const std::vector<Candidate>& existing_candidates = Candidates(); | 476 const std::vector<Candidate>& existing_candidates = Candidates(); |
471 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); | 477 std::vector<Candidate>::const_iterator it = existing_candidates.begin(); |
472 for (; it != existing_candidates.end(); ++it) { | 478 for (; it != existing_candidates.end(); ++it) { |
473 if (it->address() == addr) | 479 if (it->address() == addr) |
474 return true; | 480 return true; |
475 } | 481 } |
476 return false; | 482 return false; |
477 } | 483 } |
478 | 484 |
479 } // namespace cricket | 485 } // namespace cricket |
OLD | NEW |