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

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

Issue 2685053004: Add the URL attribute to cricket::Candiate. (Closed)
Patch Set: Add the Server URL to the Candiate. Created 3 years, 10 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
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // If socket isn't bound yet the address will be added in 171 // If socket isn't bound yet the address will be added in
172 // OnAddressReady(). Socket may be in the CLOSED state if Listen() 172 // OnAddressReady(). Socket may be in the CLOSED state if Listen()
173 // failed, we still want to add the socket address. 173 // failed, we still want to add the socket address.
174 LOG(LS_VERBOSE) << "Preparing TCP address, current state: " 174 LOG(LS_VERBOSE) << "Preparing TCP address, current state: "
175 << socket_->GetState(); 175 << socket_->GetState();
176 if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND || 176 if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND ||
177 socket_->GetState() == rtc::AsyncPacketSocket::STATE_CLOSED) 177 socket_->GetState() == rtc::AsyncPacketSocket::STATE_CLOSED)
178 AddAddress(socket_->GetLocalAddress(), socket_->GetLocalAddress(), 178 AddAddress(socket_->GetLocalAddress(), socket_->GetLocalAddress(),
179 rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", 179 rtc::SocketAddress(), TCP_PROTOCOL_NAME, "",
180 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, 180 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE,
181 ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); 181 ICE_TYPE_PREFERENCE_HOST_TCP, 0, "", true);
182 } else { 182 } else {
183 LOG_J(LS_INFO, this) << "Not listening due to firewall restrictions."; 183 LOG_J(LS_INFO, this) << "Not listening due to firewall restrictions.";
184 // Note: We still add the address, since otherwise the remote side won't 184 // Note: We still add the address, since otherwise the remote side won't
185 // recognize our incoming TCP connections. According to 185 // recognize our incoming TCP connections. According to
186 // https://tools.ietf.org/html/rfc6544#section-4.5, for active candidate, 186 // https://tools.ietf.org/html/rfc6544#section-4.5, for active candidate,
187 // the port must be set to the discard port, i.e. 9. 187 // the port must be set to the discard port, i.e. 9.
188 AddAddress(rtc::SocketAddress(ip(), DISCARD_PORT), 188 AddAddress(rtc::SocketAddress(ip(), DISCARD_PORT),
189 rtc::SocketAddress(ip(), 0), rtc::SocketAddress(), 189 rtc::SocketAddress(ip(), 0), rtc::SocketAddress(),
190 TCP_PROTOCOL_NAME, "", TCPTYPE_ACTIVE_STR, LOCAL_PORT_TYPE, 190 TCP_PROTOCOL_NAME, "", TCPTYPE_ACTIVE_STR, LOCAL_PORT_TYPE,
191 ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); 191 ICE_TYPE_PREFERENCE_HOST_TCP, 0, "", true);
192 } 192 }
193 } 193 }
194 194
195 int TCPPort::SendTo(const void* data, size_t size, 195 int TCPPort::SendTo(const void* data, size_t size,
196 const rtc::SocketAddress& addr, 196 const rtc::SocketAddress& addr,
197 const rtc::PacketOptions& options, 197 const rtc::PacketOptions& options,
198 bool payload) { 198 bool payload) {
199 rtc::AsyncPacketSocket * socket = NULL; 199 rtc::AsyncPacketSocket * socket = NULL;
200 TCPConnection* conn = static_cast<TCPConnection*>(GetConnection(addr)); 200 TCPConnection* conn = static_cast<TCPConnection*>(GetConnection(addr));
201 201
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) { 295 void TCPPort::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
296 Port::OnReadyToSend(); 296 Port::OnReadyToSend();
297 } 297 }
298 298
299 void TCPPort::OnAddressReady(rtc::AsyncPacketSocket* socket, 299 void TCPPort::OnAddressReady(rtc::AsyncPacketSocket* socket,
300 const rtc::SocketAddress& address) { 300 const rtc::SocketAddress& address) {
301 AddAddress(address, address, rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", 301 AddAddress(address, address, rtc::SocketAddress(), TCP_PROTOCOL_NAME, "",
302 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP, 302 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP,
303 0, true); 303 0, "", true);
304 } 304 }
305 305
306 TCPConnection::TCPConnection(TCPPort* port, 306 TCPConnection::TCPConnection(TCPPort* port,
307 const Candidate& candidate, 307 const Candidate& candidate,
308 rtc::AsyncPacketSocket* socket) 308 rtc::AsyncPacketSocket* socket)
309 : Connection(port, 0, candidate), 309 : Connection(port, 0, candidate),
310 socket_(socket), 310 socket_(socket),
311 error_(0), 311 error_(0),
312 outgoing_(socket == NULL), 312 outgoing_(socket == NULL),
313 connection_pending_(false), 313 connection_pending_(false),
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { 512 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) {
513 if (outgoing_) { 513 if (outgoing_) {
514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); 514 socket->SignalConnect.connect(this, &TCPConnection::OnConnect);
515 } 515 }
516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); 516 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket);
517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); 517 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend);
518 socket->SignalClose.connect(this, &TCPConnection::OnClose); 518 socket->SignalClose.connect(this, &TCPConnection::OnClose);
519 } 519 }
520 520
521 } // namespace cricket 521 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698