Mark TCP connections that fail initialization as failed.

This silences some spurious messages that were generated
by https://chromium-review.googlesource.com/c/chromium/src/+/1986070

Bug: chromium:1038754
Change-Id: I950b82c01a7e5be1f5e910b148c0b201f814f430
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/164529
Reviewed-by: Qingsi Wang <qingsi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30156}
This commit is contained in:
Harald Alvestrand
2020-01-06 20:01:36 +01:00
committed by Commit Bot
parent 1e63b9b213
commit dc8001705d
2 changed files with 19 additions and 8 deletions

View File

@ -1773,7 +1773,8 @@ void P2PTransportChannel::UpdateState() {
// TODO(deadbeef): Once we implement end-of-candidates signaling,
// we shouldn't go from INIT to COMPLETED.
RTC_DCHECK(state == IceTransportState::STATE_CONNECTING ||
state == IceTransportState::STATE_COMPLETED);
state == IceTransportState::STATE_COMPLETED ||
state == IceTransportState::STATE_FAILED);
break;
case IceTransportState::STATE_CONNECTING:
RTC_DCHECK(state == IceTransportState::STATE_COMPLETED ||

View File

@ -211,14 +211,24 @@ int TCPPort::SendTo(const void* data,
return SOCKET_ERROR;
}
socket = conn->socket();
if (!socket) {
// The failure to initialize should have been logged elsewhere,
// so this log is not important.
RTC_LOG(LS_INFO) << ToString()
<< ": Attempted to send to an uninitialized socket: "
<< addr.ToSensitiveString();
error_ = EHOSTUNREACH;
return SOCKET_ERROR;
}
} else {
socket = GetIncoming(addr);
}
if (!socket) {
RTC_LOG(LS_ERROR) << ToString()
<< ": Attempted to send to an unknown destination: "
<< addr.ToSensitiveString();
return SOCKET_ERROR; // TODO(tbd): Set error_
if (!socket) {
RTC_LOG(LS_ERROR) << ToString()
<< ": Attempted to send to an unknown destination: "
<< addr.ToSensitiveString();
error_ = EHOSTUNREACH;
return SOCKET_ERROR;
}
}
rtc::PacketOptions modified_options(options);
CopyPortInformationToPacketInfo(&modified_options.info_signaled_after_sent);
@ -546,7 +556,6 @@ void TCPConnection::OnReadyToSend(rtc::AsyncPacketSocket* socket) {
void TCPConnection::CreateOutgoingTcpSocket() {
RTC_DCHECK(outgoing_);
// TODO(guoweis): Handle failures here (unlikely since TCP).
int opts = (remote_candidate().protocol() == SSLTCP_PROTOCOL_NAME)
? rtc::PacketSocketFactory::OPT_TLS_FAKE
: 0;
@ -567,6 +576,7 @@ void TCPConnection::CreateOutgoingTcpSocket() {
} else {
RTC_LOG(LS_WARNING) << ToString() << ": Failed to create connection to "
<< remote_candidate().address().ToSensitiveString();
FailAndPrune();
}
}