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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 // Do not use this connection if the socket bound to a different address than | 372 // Do not use this connection if the socket bound to a different address than |
373 // the one we asked for. This is seen in Chrome, where TCP sockets cannot be | 373 // the one we asked for. This is seen in Chrome, where TCP sockets cannot be |
374 // given a binding address, and the platform is expected to pick the | 374 // given a binding address, and the platform is expected to pick the |
375 // correct local address. | 375 // correct local address. |
376 const rtc::IPAddress& socket_ip = socket->GetLocalAddress().ipaddr(); | 376 const rtc::IPAddress& socket_ip = socket->GetLocalAddress().ipaddr(); |
377 if (socket_ip == port()->ip()) { | 377 if (socket_ip == port()->ip()) { |
378 LOG_J(LS_VERBOSE, this) << "Connection established to " | 378 LOG_J(LS_VERBOSE, this) << "Connection established to " |
379 << socket->GetRemoteAddress().ToSensitiveString(); | 379 << socket->GetRemoteAddress().ToSensitiveString(); |
380 set_connected(true); | 380 set_connected(true); |
381 connection_pending_ = false; | 381 connection_pending_ = false; |
382 } else if (IPIsAny(port()->ip())) { | |
juberti
2015/09/23 21:00:15
I would have just combined this into the case abov
| |
383 LOG(LS_WARNING) << "Socket is bound to a different address:" | |
384 << socket->GetLocalAddress().ipaddr().ToString() | |
385 << ", rather then the local port:" | |
386 << port()->ip().ToString() | |
387 << ". Still allowing it since it's any address" | |
388 << ", possibly caused by multi-routes being disabled."; | |
389 set_connected(true); | |
390 connection_pending_ = false; | |
382 } else { | 391 } else { |
383 LOG_J(LS_WARNING, this) << "Dropping connection as TCP socket bound to IP " | 392 LOG_J(LS_WARNING, this) << "Dropping connection as TCP socket bound to IP " |
384 << socket_ip.ToSensitiveString() | 393 << socket_ip.ToSensitiveString() |
385 << ", different from the local candidate IP " | 394 << ", different from the local candidate IP " |
386 << port()->ip().ToSensitiveString(); | 395 << port()->ip().ToSensitiveString(); |
387 OnClose(socket, 0); | 396 OnClose(socket, 0); |
388 } | 397 } |
389 } | 398 } |
390 | 399 |
391 void TCPConnection::OnClose(rtc::AsyncPacketSocket* socket, int error) { | 400 void TCPConnection::OnClose(rtc::AsyncPacketSocket* socket, int error) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 491 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
483 if (outgoing_) { | 492 if (outgoing_) { |
484 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 493 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
485 } | 494 } |
486 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 495 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
487 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 496 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
488 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 497 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
489 } | 498 } |
490 | 499 |
491 } // namespace cricket | 500 } // namespace cricket |
OLD | NEW |