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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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. |
188 AddAddress(rtc::SocketAddress(ip(), 0), rtc::SocketAddress(ip(), 0), | 188 AddAddress(rtc::SocketAddress(ip(), DISCARD_PORT), |
pthatcher1
2015/11/11 20:06:24
Can you please leave a comment explaining why DISC
| |
189 rtc::SocketAddress(), TCP_PROTOCOL_NAME, "", TCPTYPE_ACTIVE_STR, | 189 rtc::SocketAddress(ip(), 0), rtc::SocketAddress(), |
190 LOCAL_PORT_TYPE, ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); | 190 TCP_PROTOCOL_NAME, "", TCPTYPE_ACTIVE_STR, LOCAL_PORT_TYPE, |
191 ICE_TYPE_PREFERENCE_HOST_TCP, 0, true); | |
191 } | 192 } |
192 } | 193 } |
193 | 194 |
194 int TCPPort::SendTo(const void* data, size_t size, | 195 int TCPPort::SendTo(const void* data, size_t size, |
195 const rtc::SocketAddress& addr, | 196 const rtc::SocketAddress& addr, |
196 const rtc::PacketOptions& options, | 197 const rtc::PacketOptions& options, |
197 bool payload) { | 198 bool payload) { |
198 rtc::AsyncPacketSocket * socket = NULL; | 199 rtc::AsyncPacketSocket * socket = NULL; |
199 TCPConnection* conn = static_cast<TCPConnection*>(GetConnection(addr)); | 200 TCPConnection* conn = static_cast<TCPConnection*>(GetConnection(addr)); |
200 | 201 |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
498 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 499 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
499 if (outgoing_) { | 500 if (outgoing_) { |
500 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 501 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
501 } | 502 } |
502 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 503 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
503 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 504 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
504 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 505 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
505 } | 506 } |
506 | 507 |
507 } // namespace cricket | 508 } // namespace cricket |
OLD | NEW |