Skip to content

Commit

Permalink
[TurnPort] Check if turn entry was found when deleting a connection.
Browse files Browse the repository at this point in the history
This is a simple way to avoid crashing, but the underlying issue
of why the entry has been removed, is a bit more complex to fix
and will be fixed in a follow-up CL.

Using no-try to land since the win_asan bot is failing for an unrelated
reason and all other bots have passed.

(cherry picked from commit 9c60649)

No-try: true
Bug: chromium:1374310
Change-Id: I9dc0cf9e1acdcc3b3a205104346cc835b3f79c1b
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/279283
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Original-Commit-Position: refs/heads/main@{#38405}
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/280221
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/branch-heads/5359@{webrtc-sdk#2}
Cr-Branched-From: fb3bd4a-refs/heads/main@{#38387}
  • Loading branch information
Tommi authored and WebRTC LUCI CQ committed Oct 24, 2022
1 parent bfb453a commit ffceb9b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion p2p/base/turn_port.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,15 @@ void TurnPort::HandleConnectionDestroyed(Connection* conn) {
// already destroyed.
const rtc::SocketAddress& remote_address = conn->remote_candidate().address();
TurnEntry* entry = FindEntry(remote_address);
RTC_DCHECK(entry != NULL);
if (!entry) {
// TODO(chromium:1374310): This happens because more than one connection
// may be associated with an entry. Previously a connection with the same
// address has been destroyed and subsequently the entry removed
// (prematurely.)
RTC_DLOG_F(LS_WARNING) << "Entry has been removed.";
return;
}

RTC_DCHECK(!entry->destruction_timestamp().has_value());
int64_t timestamp = rtc::TimeMillis();
entry->set_destruction_timestamp(timestamp);
Expand Down

0 comments on commit ffceb9b

Please sign in to comment.