Skip to content

Commit 6c8f74e

Browse files
committed
Simplify descriptions for unauth UDP connections.
This is an important use case. (Kind of the only use case in the opensource code right now...)
1 parent 2e047a3 commit 6c8f74e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/steamnetworkingsockets/clientlib/steamnetworkingsockets_udp.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,22 @@ void CSteamNetworkConnectionUDP::GetConnectionTypeDescription( ConnectionTypeDes
518518
{
519519
char szAddr[ 64 ];
520520
if ( m_pSocket )
521-
V_strcpy_safe( szAddr, CUtlNetAdrRender( m_pSocket->GetRemoteHostAddr() ).String() );
521+
{
522+
SteamNetworkingIPAddr adrRemote;
523+
NetAdrToSteamNetworkingIPAddr( adrRemote, m_pSocket->GetRemoteHostAddr() );
524+
adrRemote.ToString( szAddr, sizeof(szAddr), true );
525+
if (
526+
m_identityRemote.IsLocalHost()
527+
|| ( m_identityRemote.m_eType == k_ESteamNetworkingIdentityType_IPAddress && adrRemote == m_identityRemote.m_ip )
528+
) {
529+
V_sprintf_safe( szDescription, "UDP %s", szAddr );
530+
return;
531+
}
532+
}
522533
else
534+
{
523535
V_strcpy_safe( szAddr, "???" );
536+
}
524537

525538
SteamNetworkingIdentityRender sIdentity( m_identityRemote );
526539

0 commit comments

Comments
 (0)