@@ -1266,7 +1266,21 @@ void CSteamNetworkingICESession::InvalidateInterfaceList()
12661266
12671267void CSteamNetworkingICESession::SetSelectedCandidatePair ( ICECandidatePair *pPair )
12681268{
1269- SpewMsg ( " \n\n Selected candidate %s -> %s.\n\n " , SteamNetworkingIPAddrRender ( pPair->m_localCandidate .m_pInterface ->m_pSocket ->m_boundAddr ).c_str (), SteamNetworkingIPAddrRender ( pPair->m_remoteCandidate .m_addr ).c_str () );
1269+ // FIXME Should get info and config value from connection
1270+ const int nLogLevel = GlobalConfig::LogLevel_P2PRendezvous.Get ();
1271+ if ( pPair->m_localCandidate .IsRelay () )
1272+ {
1273+ SpewVerboseGroup ( nLogLevel, " ICE selected candidate %s -> %s -> %s." ,
1274+ SteamNetworkingIPAddrRender ( pPair->m_localCandidate .m_pInterface ->m_pSocket ->m_boundAddr ).c_str (),
1275+ SteamNetworkingIPAddrRender ( pPair->m_localCandidate .m_addrTURNServer ).c_str (),
1276+ SteamNetworkingIPAddrRender ( pPair->m_remoteCandidate .m_addr ).c_str () );
1277+ }
1278+ else
1279+ {
1280+ SpewVerboseGroup ( nLogLevel, " ICE selected candidate %s -> %s." ,
1281+ SteamNetworkingIPAddrRender ( pPair->m_localCandidate .m_pInterface ->m_pSocket ->m_boundAddr ).c_str (),
1282+ SteamNetworkingIPAddrRender ( pPair->m_remoteCandidate .m_addr ).c_str () );
1283+ }
12701284 m_pSelectedCandidatePair = pPair;
12711285 if ( m_pCallbacks )
12721286 m_pCallbacks->OnConnectionSelected ( pPair->m_localCandidate , pPair->m_remoteCandidate );
@@ -1341,7 +1355,7 @@ void CSteamNetworkingICESession::GatherInterfaces()
13411355 {
13421356 // ICESessionInterface disappeared! Delete the socket and all candidates
13431357 // and pairs that use it
1344- SpewMsg ( " Local interface %s removed\n " , SteamNetworkingIPAddrRender ( intf->m_pSocket ->m_boundAddr ).c_str () );
1358+ SpewMsg ( " ICE: Local interface %s removed\n " , SteamNetworkingIPAddrRender ( intf->m_pSocket ->m_boundAddr ).c_str () );
13451359
13461360 for ( int j = len ( m_vecCandidatePairs ) - 1 ; j >= 0 ; --j )
13471361 {
@@ -1378,7 +1392,7 @@ void CSteamNetworkingICESession::GatherInterfaces()
13781392 pIntf->m_pSocket = OpenRawUDPSocket ( CRecvPacketCallback ( CSteamNetworkingICESession::StaticPacketReceived, pIntf.get () ), errMsg, &bindAddr, nullptr );
13791393 if ( pIntf->m_pSocket == nullptr )
13801394 {
1381- SpewWarning ( " Could not bind to %s, skipping interface. %s\n " , SteamNetworkingIPAddrRender ( addr.m_addr ).c_str (), errMsg );
1395+ SpewWarning ( " ICE: Could not bind to %s, skipping interface. %s\n " , SteamNetworkingIPAddrRender ( addr.m_addr ).c_str (), errMsg );
13821396 continue ;
13831397 }
13841398
@@ -1502,6 +1516,8 @@ void CSteamNetworkingICESession::OnPacketReceived( const RecvPktInfo_t &info, IC
15021516 return ;
15031517 }
15041518
1519+ const int nLogLevel = GlobalConfig::LogLevel_P2PRendezvous.Get ();
1520+
15051521 //
15061522 // Incoming binding request
15071523 //
@@ -1516,7 +1532,7 @@ void CSteamNetworkingICESession::OnPacketReceived( const RecvPktInfo_t &info, IC
15161532 {
15171533 if ( pUsernameAttr->m_nLength < (uint32)m_strIncomingUsername.size () )
15181534 {
1519- SpewMsg ( " Incorrect username length; at least %d expected, got %d." , (int )m_strIncomingUsername.size (), pUsernameAttr->m_nLength );
1535+ SpewMsgGroup ( nLogLevel, " ICE: Incorrect username length; at least %d expected, got %d." , (int )m_strIncomingUsername.size (), pUsernameAttr->m_nLength );
15201536 return ;
15211537 }
15221538 if ( m_strIncomingUsername.size () == 0 )
@@ -1533,7 +1549,7 @@ void CSteamNetworkingICESession::OnPacketReceived( const RecvPktInfo_t &info, IC
15331549 }
15341550 if ( nLen == 0 )
15351551 {
1536- SpewMsg ( " Invalid username; no : found in %s" , std::string ( (const char *)( pUsernameAttr->m_pData ),pUsernameAttr->m_nLength ).c_str () );
1552+ SpewMsgGroup ( nLogLevel, " ICE: Invalid username; no : found in %s" , std::string ( (const char *)( pUsernameAttr->m_pData ),pUsernameAttr->m_nLength ).c_str () );
15371553 return ;
15381554 }
15391555
@@ -1543,7 +1559,7 @@ void CSteamNetworkingICESession::OnPacketReceived( const RecvPktInfo_t &info, IC
15431559 else if ( V_memcmp ( pUsernameAttr->m_pData , m_strIncomingUsername.c_str (), m_strIncomingUsername.size () ) != 0 )
15441560 {
15451561 std::string remoteName ( (char *)pUsernameAttr->m_pData , pUsernameAttr->m_nLength );
1546- SpewMsg ( " Incorrect username: got '%s' expected '%s'." , remoteName.c_str (), m_strIncomingUsername.c_str () );
1562+ SpewMsgGroup ( nLogLevel, " ICE: Incorrect username: got '%s' expected '%s'." , remoteName.c_str (), m_strIncomingUsername.c_str () );
15471563 return ;
15481564 }
15491565 }
@@ -1556,7 +1572,7 @@ void CSteamNetworkingICESession::OnPacketReceived( const RecvPktInfo_t &info, IC
15561572 // Find the candidate pair for this binding request, if any
15571573 //
15581574
1559- SpewMsg ( " Incoming binding request from %s to %s.\n\n " , SteamNetworkingIPAddrRender ( fromAddr ).c_str (), SteamNetworkingIPAddrRender ( pInterface->m_pSocket ->m_boundAddr ).c_str () );
1575+ SpewVerboseGroup ( nLogLevel, " ICE: Incoming binding request from %s to %s.\n\n " , SteamNetworkingIPAddrRender ( fromAddr ).c_str (), SteamNetworkingIPAddrRender ( pInterface->m_pSocket ->m_boundAddr ).c_str () );
15601576
15611577 ICELocalCandidate localCandidate{ pInterface, pAddrRelay ? *pAddrRelay : SteamNetworkingIPAddr{} };
15621578
@@ -1674,7 +1690,7 @@ void CSteamNetworkingICESession::OnPacketReceived( const RecvPktInfo_t &info, IC
16741690 (const uint8*)m_strLocalPassword.c_str (), (uint32)m_strLocalPassword.size (), outAttrs.Base (), outAttrs.Count () );
16751691 if ( nByteCount > 0 )
16761692 {
1677- SpewMsg ( " Sending a STUN response to %s from %s." , SteamNetworkingIPAddrRender ( fromAddr, true ).c_str (), SteamNetworkingIPAddrRender ( pInterface->m_pSocket ->m_boundAddr , true ).c_str () );
1693+ SpewVerboseGroup ( nLogLevel, " ICE: Sending a STUN response to %s from %s." , SteamNetworkingIPAddrRender ( fromAddr, true ).c_str (), SteamNetworkingIPAddrRender ( pInterface->m_pSocket ->m_boundAddr , true ).c_str () );
16781694 iovec iov{ responseBuffer, (size_t )nByteCount };
16791695 pInterface->SendPacketGather ( 1 , &iov, nByteCount, fromAddr, localCandidate.m_addrTURNServer );
16801696 }
0 commit comments