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

Side by Side Diff: webrtc/p2p/base/tcpport.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/tcpport.h ('k') | webrtc/p2p/base/turnport.h » ('j') | 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 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 void TCPPort::OnNewConnection(rtc::AsyncPacketSocket* socket, 252 void TCPPort::OnNewConnection(rtc::AsyncPacketSocket* socket,
253 rtc::AsyncPacketSocket* new_socket) { 253 rtc::AsyncPacketSocket* new_socket) {
254 ASSERT(socket == socket_); 254 ASSERT(socket == socket_);
255 255
256 Incoming incoming; 256 Incoming incoming;
257 incoming.addr = new_socket->GetRemoteAddress(); 257 incoming.addr = new_socket->GetRemoteAddress();
258 incoming.socket = new_socket; 258 incoming.socket = new_socket;
259 incoming.socket->SignalReadPacket.connect(this, &TCPPort::OnReadPacket); 259 incoming.socket->SignalReadPacket.connect(this, &TCPPort::OnReadPacket);
260 incoming.socket->SignalReadyToSend.connect(this, &TCPPort::OnReadyToSend); 260 incoming.socket->SignalReadyToSend.connect(this, &TCPPort::OnReadyToSend);
261 incoming.socket->SignalSentPacket.connect(this, &TCPPort::OnSentPacket);
261 262
262 LOG_J(LS_VERBOSE, this) << "Accepted connection from " 263 LOG_J(LS_VERBOSE, this) << "Accepted connection from "
263 << incoming.addr.ToSensitiveString(); 264 << incoming.addr.ToSensitiveString();
264 incoming_.push_back(incoming); 265 incoming_.push_back(incoming);
265 } 266 }
266 267
267 rtc::AsyncPacketSocket* TCPPort::GetIncoming( 268 rtc::AsyncPacketSocket* TCPPort::GetIncoming(
268 const rtc::SocketAddress& addr, bool remove) { 269 const rtc::SocketAddress& addr, bool remove) {
269 rtc::AsyncPacketSocket* socket = NULL; 270 rtc::AsyncPacketSocket* socket = NULL;
270 for (std::list<Incoming>::iterator it = incoming_.begin(); 271 for (std::list<Incoming>::iterator it = incoming_.begin();
271 it != incoming_.end(); ++it) { 272 it != incoming_.end(); ++it) {
272 if (it->addr == addr) { 273 if (it->addr == addr) {
273 socket = it->socket; 274 socket = it->socket;
274 if (remove) 275 if (remove)
275 incoming_.erase(it); 276 incoming_.erase(it);
276 break; 277 break;
277 } 278 }
278 } 279 }
279 return socket; 280 return socket;
280 } 281 }
281 282
282 void TCPPort::OnReadPacket(rtc::AsyncPacketSocket* socket, 283 void TCPPort::OnReadPacket(rtc::AsyncPacketSocket* socket,
283 const char* data, size_t size, 284 const char* data, size_t size,
284 const rtc::SocketAddress& remote_addr, 285 const rtc::SocketAddress& remote_addr,
285 const rtc::PacketTime& packet_time) { 286 const rtc::PacketTime& packet_time) {
286 Port::OnReadPacket(data, size, remote_addr, PROTO_TCP); 287 Port::OnReadPacket(data, size, remote_addr, PROTO_TCP);
287 } 288 }
288 289
290 void TCPPort::OnSentPacket(rtc::AsyncPacketSocket* socket,
291 const rtc::SentPacket& sent_packet) {
292 ASSERT(socket == socket_);
293 PortInterface::SignalSentPacket(sent_packet);
294 }
295
289 void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { 296 void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
290 Port::OnReadyToSend(); 297 Port::OnReadyToSend();
291 } 298 }
292 299
293 void TCPPort::OnAddressReady(rtc::AsyncPacketSocket* socket, 300 void TCPPort::OnAddressReady(rtc::AsyncPacketSocket* socket,
294 const rtc::SocketAddress& address) { 301 const rtc::SocketAddress& address) {
295 AddAddress(address, address, rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", 302 AddAddress(address, address, rtc::SocketAddress(), TCP_PROTOCOL_NAME, "",
296 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP, 303 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP,
297 0, true); 304 0, true);
298 } 305 }
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { 506 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) {
500 if (outgoing_) { 507 if (outgoing_) {
501 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); 508 socket->SignalConnect.connect(this, &TCPConnection::OnConnect);
502 } 509 }
503 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); 510 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket);
504 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); 511 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend);
505 socket->SignalClose.connect(this, &TCPConnection::OnClose); 512 socket->SignalClose.connect(this, &TCPConnection::OnClose);
506 } 513 }
507 514
508 } // namespace cricket 515 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/tcpport.h ('k') | webrtc/p2p/base/turnport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698