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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 ASSERT(write_state() == STATE_WRITABLE); | 367 ASSERT(write_state() == STATE_WRITABLE); |
368 } | 368 } |
369 | 369 |
370 void TCPConnection::OnConnect(rtc::AsyncPacketSocket* socket) { | 370 void TCPConnection::OnConnect(rtc::AsyncPacketSocket* socket) { |
371 ASSERT(socket == socket_); | 371 ASSERT(socket == socket_); |
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() || IPIsAny(port()->ip())) { |
378 LOG_J(LS_VERBOSE, this) << "Connection established to " | 378 if (socket_ip == port()->ip()) { |
379 << socket->GetRemoteAddress().ToSensitiveString(); | 379 LOG_J(LS_VERBOSE, this) << "Connection established to " |
380 set_connected(true); | 380 << socket->GetRemoteAddress().ToSensitiveString(); |
381 connection_pending_ = false; | 381 } else { |
382 } else if (IPIsAny(port()->ip())) { | 382 LOG(LS_WARNING) << "Socket is bound to a different address:" |
383 LOG(LS_WARNING) << "Socket is bound to a different address:" | 383 << socket->GetLocalAddress().ipaddr().ToString() |
384 << socket->GetLocalAddress().ipaddr().ToString() | 384 << ", rather then the local port:" |
385 << ", rather then the local port:" | 385 << port()->ip().ToString() |
386 << port()->ip().ToString() | 386 << ". Still allowing it since it's any address" |
387 << ". Still allowing it since it's any address" | 387 << ", possibly caused by multi-routes being disabled."; |
388 << ", possibly caused by multi-routes being disabled."; | 388 } |
389 set_connected(true); | 389 set_connected(true); |
390 connection_pending_ = false; | 390 connection_pending_ = false; |
391 } else { | 391 } else { |
392 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 " |
393 << socket_ip.ToSensitiveString() | 393 << socket_ip.ToSensitiveString() |
394 << ", different from the local candidate IP " | 394 << ", different from the local candidate IP " |
395 << port()->ip().ToSensitiveString(); | 395 << port()->ip().ToSensitiveString(); |
396 OnClose(socket, 0); | 396 OnClose(socket, 0); |
397 } | 397 } |
398 } | 398 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { | 491 void TCPConnection::ConnectSocketSignals(rtc::AsyncPacketSocket* socket) { |
492 if (outgoing_) { | 492 if (outgoing_) { |
493 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); | 493 socket->SignalConnect.connect(this, &TCPConnection::OnConnect); |
494 } | 494 } |
495 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); | 495 socket->SignalReadPacket.connect(this, &TCPConnection::OnReadPacket); |
496 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); | 496 socket->SignalReadyToSend.connect(this, &TCPConnection::OnReadyToSend); |
497 socket->SignalClose.connect(this, &TCPConnection::OnClose); | 497 socket->SignalClose.connect(this, &TCPConnection::OnClose); |
498 } | 498 } |
499 | 499 |
500 } // namespace cricket | 500 } // namespace cricket |
OLD | NEW |