From 6c8dfe5fbcafabffe8967c235fd0df31b4355875 Mon Sep 17 00:00:00 2001 From: Fletcher Dunn Date: Tue, 1 Sep 2020 06:23:52 -0700 Subject: [PATCH] Use custom signaling path to connect --- tests/test_p2p.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_p2p.cpp b/tests/test_p2p.cpp index dfb5d33..96ca512 100644 --- a/tests/test_p2p.cpp +++ b/tests/test_p2p.cpp @@ -224,7 +224,19 @@ int main( int argc, const char **argv ) g_nVirtualPortLocal ); } - g_hConnection = SteamNetworkingSockets()->ConnectP2P( identityRemote, g_nVirtualPortRemote, (int)vecOpts.size(), vecOpts.data() ); + // Connect using the "custom signaling" path. Note that when + // you are using this path, the identity is actually optional, + // since we don't need it. (Your signaling object already + // knows how to talk to the peer) and then the peer identity + // will be confirmed via rendezvous. + SteamNetworkingErrMsg errMsg; + ISteamNetworkingConnectionCustomSignaling *pConnSignaling = pSignaling->CreateSignalingForConnection( + identityRemote, + nullptr, + errMsg + ); + assert( pConnSignaling ); + g_hConnection = SteamNetworkingSockets()->ConnectP2PCustomSignaling( pConnSignaling, &identityRemote, g_nVirtualPortRemote, (int)vecOpts.size(), vecOpts.data() ); } // Main test loop