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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 << socket_->GetState(); | 177 << socket_->GetState(); |
178 if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND || | 178 if (socket_->GetState() == rtc::AsyncPacketSocket::STATE_BOUND || |
179 socket_->GetState() == rtc::AsyncPacketSocket::STATE_CLOSED) | 179 socket_->GetState() == rtc::AsyncPacketSocket::STATE_CLOSED) |
180 AddAddress(socket_->GetLocalAddress(), socket_->GetLocalAddress(), | 180 AddAddress(socket_->GetLocalAddress(), socket_->GetLocalAddress(), |
181 rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", | 181 rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", |
182 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, | 182 TCPTYPE_PASSIVE_STR, LOCAL_PORT_TYPE, |
183 ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); | 183 ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); |
184 } else { | 184 } else { |
185 LOG_J(LS_INFO, this) << "Not listening due to firewall restrictions."; | 185 LOG_J(LS_INFO, this) << "Not listening due to firewall restrictions."; |
186 // Note: We still add the address, since otherwise the remote side won't | 186 // Note: We still add the address, since otherwise the remote side won't |
187 // recognize our incoming TCP connections. | 187 // recognize our incoming TCP connections. According to |
188 AddAddress(rtc::SocketAddress(ip(), 0), rtc::SocketAddress(ip(), 0), | 188 // https://tools.ietf.org/html/rfc6544#section-4.5, for active candidate, |
189 rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", TCPTYPE_ACTIVE_STR, | 189 // the port must be set to the discard port, i.e. 9. |
190 LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); | 190 AddAddress(rtc::SocketAddress(ip(), DISCARD_PORT), |
| 191 rtc::SocketAddress(ip(), 0), rtc::SocketAddress(), |
| 192 TCP_PROTOCOL_NAME, "", TCPTYPE_ACTIVE_STR, LOCAL_PORT_TYPE, |
| 193 ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); |
191 } | 194 } |
192 } | 195 } |
193 | 196 |
194 int TCPPort::SendTo(const void* data, size_t size, | 197 int TCPPort::SendTo(const void* data, size_t size, |
195 const rtc::SocketAddress& addr, | 198 const rtc::SocketAddress& addr, |
196 const rtc::PacketOptions& options, | 199 const rtc::PacketOptions& options, |
197 bool payload) { | 200 bool payload) { |
198 rtc::AsyncPacketSocket * socket = NULL; | 201 rtc::AsyncPacketSocket * socket = NULL; |
199 TCPConnection* conn = static_cast<TCPConnection*>(GetConnection(addr)); | 202 TCPConnection* conn = static_cast<TCPConnection*>(GetConnection(addr)); |
200 | 203 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 501 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
499 if (outgoing_) { | 502 if (outgoing_) { |
500 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 503 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
501 } | 504 } |
502 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 505 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
503 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 506 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
504 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 507 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
505 } | 508 } |
506 | 509 |
507 } // namespace cricket | 510 } // namespace cricket |
OLD | NEW |