Tweak P2P stats

P4:6570979
This commit is contained in:
Fletcher Dunn
2021-05-28 16:21:43 -07:00
parent a4cb590616
commit 6eccecbd6e
2 changed files with 17 additions and 1 deletions
@@ -321,6 +321,12 @@ message CMsgSteamNetworkingICESessionSummary
optional uint32 initial_score = 6;
optional uint32 negotiation_ms = 5; // How long did it take to get a NAT traversal result (either success or failure)
// Best route and score we ever had over the life of the connection
optional uint32 best_route_kind = 16; // ESteamNetTransportKind
optional uint32 best_ping = 17;
optional uint32 best_score = 18;
optional uint32 best_time = 19; // seconds into the connections when this happened
// How long were we the selcted transport?
optional uint32 selected_seconds = 12;
@@ -295,14 +295,24 @@ void CConnectionTransportP2PICE::P2PTransportUpdateRouteMetrics( SteamNetworking
// Check for recording the initial scoring data used to make the initial decision
CMsgSteamNetworkingICESessionSummary &ice_summary = Connection().m_msgICESessionSummary;
uint32 nScore = m_routeMetrics.m_nScoreCurrent + m_routeMetrics.m_nTotalPenalty;
if (
ConnectionState() == k_ESteamNetworkingConnectionState_FindingRoute
|| !ice_summary.has_initial_ping()
|| ( nScore < ice_summary.initial_score() && usecNow < Connection().m_usecWhenCreated + 15*k_nMillion )
) {
ice_summary.set_initial_score( m_routeMetrics.m_nScoreCurrent + m_routeMetrics.m_nTotalPenalty );
ice_summary.set_initial_score( nScore );
ice_summary.set_initial_ping( m_pingEndToEnd.m_nSmoothedPing );
ice_summary.set_initial_route_kind( m_eCurrentRouteKind );
}
if ( !ice_summary.has_best_score() || nScore < ice_summary.best_score() )
{
ice_summary.set_best_score( nScore );
ice_summary.set_best_ping( m_pingEndToEnd.m_nSmoothedPing );
ice_summary.set_best_route_kind( m_eCurrentRouteKind );
ice_summary.set_best_time( ( usecNow - Connection().m_usecWhenCreated + 500*1000 ) / k_nMillion );
}
}
#define ParseProtobufBody( pvMsg, cbMsg, CMsgCls, msgVar ) \