@@ -83,6 +83,9 @@ class ISteamNetworkingSockets
8383 // / in that case, use zero. If you need to open multiple listen sockets and have clients
8484 // / be able to connect to one or the other, then nVirtualPort should be a small integer (<1000)
8585 // / unique to each listen socket you create.
86+ // /
87+ // / If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
88+ // / when your app initializes
8689 virtual HSteamListenSocket CreateListenSocketP2P ( int nVirtualPort ) = 0;
8790
8891 // / Begin connecting to a server that is identified using a platform-specific identifier.
@@ -93,6 +96,9 @@ class ISteamNetworkingSockets
9396 // / Set the SteamID (whether "user" or "gameserver") and Steam will determine if the
9497 // / client is online and facilitate a relay connection. Note that all P2P connections on
9598 // / Steam are currently relayed.
99+ // /
100+ // / If you use this, you probably want to call ISteamNetworkingUtils::InitializeRelayNetworkAccess()
101+ // / when your app initializes
96102 virtual HSteamNetConnection ConnectP2P ( const SteamNetworkingIdentity &identityRemote, int nVirtualPort ) = 0;
97103#endif
98104
@@ -352,12 +358,54 @@ extern "C" {
352358#else
353359#error "Must define VALVE_CALLBACK_PACK_SMALL or VALVE_CALLBACK_PACK_LARGE"
354360#endif
361+
362+ // / This callback is posted whenever a connection is created, destroyed, or changes state.
363+ // / The m_info field will contain a complete description of the connection at the time the
364+ // / change occurred and the callback was posted. In particular, m_eState will have the
365+ // / new connection state.
366+ // /
367+ // / You will usually need to listen for this callback to know when:
368+ // / - A new connection arrives on a listen socket.
369+ // / m_info.m_hListenSocket will be set, m_eOldState = k_ESteamNetworkingConnectionState_None,
370+ // / and m_info.m_eState = k_ESteamNetworkingConnectionState_Connecting.
371+ // / See ISteamNetworkigSockets::AcceptConnection.
372+ // / - A connection you initiated has been accepted by the remote host.
373+ // / m_eOldState = k_ESteamNetworkingConnectionState_Connecting, and
374+ // / m_info.m_eState = k_ESteamNetworkingConnectionState_Connected.
375+ // / Some connections might transition to k_ESteamNetworkingConnectionState_FindingRoute first.
376+ // / - A connection has been actively rejected or closed by the remote host.
377+ // / m_eOldState = k_ESteamNetworkingConnectionState_Connecting or k_ESteamNetworkingConnectionState_Connected,
378+ // / and m_info.m_eState = k_ESteamNetworkingConnectionState_ClosedByPeer. m_info.m_eEndReason
379+ // / and m_info.m_szEndDebug will have for more details.
380+ // / NOTE: upon receiving this callback, you must still destroy the connection using
381+ // / ISteamNetworkingSockets::CloseConnection to free up local resources. (The details
382+ // / passed to the function are not used in this case, since the connection is already closed.)
383+ // / - A problem was detected with the connection, and it has been closed by the local host.
384+ // / The most common failure is timeout, but other configuration or authentication failures
385+ // / can cause this. m_eOldState = k_ESteamNetworkingConnectionState_Connecting or
386+ // / k_ESteamNetworkingConnectionState_Connected, and m_info.m_eState = k_ESteamNetworkingConnectionState_ProblemDetectedLocally.
387+ // / m_info.m_eEndReason and m_info.m_szEndDebug will have for more details.
388+ // / NOTE: upon receiving this callback, you must still destroy the connection using
389+ // / ISteamNetworkingSockets::CloseConnection to free up local resources. (The details
390+ // / passed to the function are not used in this case, since the connection is already closed.)
391+ // /
392+ // / Remember that callbacks are posted to a queue, and networking connections can
393+ // / change at any time. It is possible that the connection has already changed
394+ // / state by the time you process this callback.
395+ // /
396+ // / Also note that callbacks will be posted when connections are created and destroyed by your own API calls.
355397struct SteamNetConnectionStatusChangedCallback_t
356398{
357399 enum { k_iCallback = k_iSteamNetworkingSocketsCallbacks + 1 };
358- HSteamNetConnection m_hConn; // < Connection handle
359- SteamNetConnectionInfo_t m_info; // < Full connection info
360- int m_eOldState; // < ESNetSocketState. (Current stats is in m_info)
400+
401+ // / Connection handle
402+ HSteamNetConnection m_hConn;
403+
404+ // / Full connection info
405+ SteamNetConnectionInfo_t m_info;
406+
407+ // / Previous state. (Current state is in m_info.m_eState)
408+ ESteamNetworkingConnectionState m_eOldState;
361409};
362410#pragma pack( pop )
363411
0 commit comments