Skip to content

Commit f47a957

Browse files
committed
steamwebrtc: Small tweak to race condition fix
Don't invalidate m_nCachedPing temporarily, since the read is not protected by a lock
1 parent ee965fc commit f47a957

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/external/steamwebrtc/ice_session.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,12 +604,13 @@ void CICESession::CacheRouteAndPing()
604604

605605
std::lock_guard<std::mutex> lock( m_mutexCachedRoute );
606606
m_bCachedRouteValid = false;
607-
m_nCachedPing = -1;
608607
if ( !ice_transport_ )
608+
{
609+
m_nCachedPing = -1;
609610
return;
611+
}
610612
absl::optional<int> rtt = ice_transport_->GetRttEstimate();
611-
if ( rtt )
612-
m_nCachedPing = *rtt;
613+
m_nCachedPing = rtt ? *rtt : -1;
613614
const cricket::Connection *conn = ice_transport_->selected_connection();
614615
if ( !conn )
615616
return;

0 commit comments

Comments
 (0)