Skip to content

Fix data type for config value SetString() #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

copyrat90
Copy link

@copyrat90 copyrat90 commented Mar 11, 2025

Fix

Currently SteamNetworkingConfigValue_t::SetString() sets the m_eDataType to k_ESteamNetworkingConfig_Ptr, instead of k_ESteamNetworkingConfig_String.

This commit fixes this.

Test

I just tested this fix by editing test_p2p.cpp so that it uses non-global config instead.

Current code fails to set the option 103 (k_ESteamNetworkingConfig_P2P_STUN_ServerList) with this edit:

Running basic socket client/server test
peer_server> Executing: ./test_p2p --server --identity-local str:peer_server --identity-remote str:peer_client --signaling-server localhost:10000 --log peer_server.verbose.log
peer_client> Executing: ./test_p2p --client --identity-local str:peer_client --identity-remote str:peer_server --signaling-server localhost:10000 --log peer_client.verbose.log
peer_client>   0.006005 Initialized low level socket/threading support.
peer_server>   0.005724 Initialized low level socket/threading support.
peer_client>   0.011518 Connecting to 'str:peer_server', virtual port 0, from local virtual port 0.
peer_server>   0.011159 Creating listen socket, local virtual port 0
peer_client>   0.011533 Creating signaling session for peer 'str:peer_server'
peer_server>   0.011191 Cannot create listen socket.  Error setting option 103
peer_server> Assertion failed: g_hListenSock != k_HSteamListenSocket_Invalid, file ..\GameNetworkingSockets\tests\test_p2p.cpp, line 243
peer_client>   0.011629 Cannot create P2P connection to str:peer_server.  Error setting option 103
peer_client> Assertion failed: g_hConnection != k_HSteamNetConnection_Invalid, file ..\GameNetworkingSockets\tests\test_p2p.cpp, line 322
signaling> 2025/03/11 22:23:48 Listening at 0.0.0.0:10000
peer_client> Exitted with 3221226505
peer_server> Exitted with 3221226505

But with this fix, it reads the local config correctly:

Running basic socket client/server test
peer_server> Executing: ./test_p2p --server --identity-local str:peer_server --identity-remote str:peer_client --signaling-server localhost:10000 --log peer_server.verbose.log
peer_client> Executing: ./test_p2p --client --identity-local str:peer_client --identity-remote str:peer_server --signaling-server localhost:10000 --log peer_client.verbose.log
signaling> 2025/03/11 22:26:12 Listening at 0.0.0.0:10000
peer_client>   0.029836 Initialized low level socket/threading support.
peer_server>   0.026900 Initialized low level socket/threading support.
peer_client>   0.035296 Connecting to 'str:peer_server', virtual port 0, from local virtual port 0.
peer_client>   0.035312 Creating signaling session for peer 'str:peer_server'
peer_server>   0.032442 Creating listen socket, local virtual port 0
signaling> 2025/03/11 22:26:12 [str:peer_server@[::1]:9809] Added connection
peer_client>   0.036716 [#1144459456 P2P str:peer_server vport 0] Relay candidates enabled by P2P_Transport_ICE_Enable, but P2P_TURN_ServerList is empty
peer_client>   0.045959 SteamNetworkingSockets lock held for 10.6ms.  (Performance warning.)  ConnectP2PCustomSignaling,Base::BInitConnection,GetIdentity,SetConfigValue,FinalizeLocalCrypto,CSteamNetworkConnectionP2P::CheckInitICE,CConnectionTransportP2PICE_Valve::Init
signaling> 2025/03/11 22:26:12 [str:peer_client@[::1]:9808] Added connection
peer_client> This is usually a symptom of a general performance problem such as thread starvation.
peer_client>   0.045977 Sending msg 'Greetings!'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant