mirror of
https://github.com/ValveSoftware/GameNetworkingSockets.git
synced 2026-05-29 16:20:34 +00:00
Delete CSteamNetworkingICESession::m_nPort and the constructor argument to specify it.
ICE should always use ephemeral ports. Binding to particular local ports doesn't really make any sense. This was originally added as a result of some confusion regarding what "virtual ports" for for. P4:7194241
This commit is contained in:
@@ -1103,8 +1103,7 @@ void CSteamNetworkingSocketsSTUNRequest::Test()
|
||||
// CSteamNetworkingICESession
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
CSteamNetworkingICESession::CSteamNetworkingICESession( uint16 nPort, ICERole role, CSteamNetworkingICESessionCallbacks *pCallbacks, int nEncoding )
|
||||
: m_nPort( nPort )
|
||||
CSteamNetworkingICESession::CSteamNetworkingICESession( ICERole role, CSteamNetworkingICESessionCallbacks *pCallbacks, int nEncoding )
|
||||
{
|
||||
m_nEncoding = nEncoding;
|
||||
m_pCallbacks = pCallbacks;
|
||||
@@ -1544,12 +1543,12 @@ void CSteamNetworkingICESession::UpdateHostCandidates()
|
||||
{
|
||||
CUtlVector< ICECandidate > vecPreviousCandidates;
|
||||
vecPreviousCandidates.Swap( m_vecCandidates );
|
||||
|
||||
|
||||
for ( int i = 0; i < m_vecInterfaces.Count(); ++i )
|
||||
{
|
||||
SteamNetworkingIPAddr hostCandidateAddr = m_vecInterfaces[i].m_localaddr;
|
||||
hostCandidateAddr.m_port = m_nPort;
|
||||
|
||||
hostCandidateAddr.m_port = 0;
|
||||
|
||||
const uint32 nLocalPriority = m_vecInterfaces[i].m_nPriority;
|
||||
bool bSawPrevCandidate = false;
|
||||
for( const ICECandidate& prevCandidate : vecPreviousCandidates )
|
||||
@@ -2138,7 +2137,7 @@ CSteamNetworkingICESession::ICECandidatePair::ICECandidatePair( const ICECandida
|
||||
|
||||
void CSteamNetworkingICESession::Test()
|
||||
{
|
||||
CSteamNetworkingICESession *pSession = new CSteamNetworkingICESession( 18000, kICERole_Controlling, nullptr, kSTUNPacketEncodingFlags_None );
|
||||
CSteamNetworkingICESession *pSession = new CSteamNetworkingICESession( kICERole_Controlling, nullptr, kSTUNPacketEncodingFlags_None );
|
||||
|
||||
CUtlVector< SteamNetworkingIPAddr > stunAddrs;
|
||||
ResolveHostname( "stun1.l.google.com:3478", &stunAddrs );
|
||||
@@ -2150,55 +2149,6 @@ void CSteamNetworkingICESession::Test()
|
||||
}
|
||||
|
||||
|
||||
/// A glue object used to take a callback from ICE, which might happen in
|
||||
/// any thread, and execute it with the proper locks.
|
||||
class IConnectionTransportP2PICERunWithLock : private CQueuedTaskOnTarget<CConnectionTransportP2PICE_Valve>
|
||||
{
|
||||
public:
|
||||
|
||||
/// Execute the callback. The global lock and connection locks will be held.
|
||||
virtual void RunTransportP2PICE( CConnectionTransportP2PICE_Valve *pTransport ) = 0;
|
||||
|
||||
inline void Queue( CConnectionTransportP2PICE_Valve *pTransport, const char *pszTag )
|
||||
{
|
||||
DbgVerify( Setup( pTransport ) ); // Caller should have already checked
|
||||
QueueToRunWithGlobalLock( pszTag );
|
||||
}
|
||||
|
||||
inline void RunOrQueue( CConnectionTransportP2PICE_Valve *pTransport, const char *pszTag )
|
||||
{
|
||||
if ( Setup( pTransport ) )
|
||||
RunWithGlobalLockOrQueue( pszTag );
|
||||
}
|
||||
|
||||
private:
|
||||
inline bool Setup( CConnectionTransportP2PICE_Valve *pTransport )
|
||||
{
|
||||
CSteamNetworkConnectionP2P &conn = pTransport->Connection();
|
||||
if ( conn.m_pTransportICE != pTransport )
|
||||
{
|
||||
delete this;
|
||||
return false;
|
||||
}
|
||||
|
||||
SetTarget( pTransport );
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void Run()
|
||||
{
|
||||
CConnectionTransportP2PICE_Valve *pTransport = Target();
|
||||
CSteamNetworkConnectionP2P &conn = pTransport->Connection();
|
||||
|
||||
ConnectionScopeLock connectionLock( conn );
|
||||
if ( conn.m_pTransportICE != pTransport )
|
||||
return;
|
||||
|
||||
RunTransportP2PICE( pTransport );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CConnectionTransportP2PICE_Valve
|
||||
@@ -2215,7 +2165,7 @@ void CConnectionTransportP2PICE_Valve::Init()
|
||||
if ( m_pICESession == nullptr )
|
||||
{
|
||||
const CSteamNetworkingICESession::ICERole role = ( Connection().IsControllingAgent() ? CSteamNetworkingICESession::kICERole_Controlling : CSteamNetworkingICESession::kICERole_Controlled );
|
||||
m_pICESession = new CSteamNetworkingICESession( 0, role, this, kSTUNPacketEncodingFlags_MessageIntegrity );
|
||||
m_pICESession = new CSteamNetworkingICESession( role, this, kSTUNPacketEncodingFlags_MessageIntegrity );
|
||||
|
||||
CUtlVector< SteamNetworkingIPAddr > stunServers;
|
||||
CUtlVectorAutoPurge<char *> tempStunServers;
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace SteamNetworkingSocketsLib {
|
||||
kICERole_Controlled,
|
||||
kICERole_None
|
||||
};
|
||||
CSteamNetworkingICESession( uint16 nPort, ICERole role, CSteamNetworkingICESessionCallbacks *pCallbacks, int nEncoding );
|
||||
CSteamNetworkingICESession( ICERole role, CSteamNetworkingICESessionCallbacks *pCallbacks, int nEncoding );
|
||||
~CSteamNetworkingICESession();
|
||||
|
||||
ICERole GetRole() { return m_role; }
|
||||
@@ -235,7 +235,6 @@ namespace SteamNetworkingSocketsLib {
|
||||
uint64 m_nRoleTiebreaker;
|
||||
ICESessionState m_sessionState;
|
||||
bool m_bInterfaceListStale;
|
||||
const uint16 m_nPort;
|
||||
int m_nEncoding;
|
||||
std::string m_strLocalUsernameFragment;
|
||||
std::string m_strLocalPassword;
|
||||
|
||||
Reference in New Issue
Block a user