@@ -187,7 +187,7 @@ void Steam_Networking_Sockets::set_steamnetconnectioninfo(std::map<HSteamNetConn
187187 pInfo->m_hListenSocket = connect_socket->second .listen_socket_id ;
188188 pInfo->m_addrRemote .Clear (); // TODO
189189 if (connect_socket->second .real_port != SNS_DISABLED_PORT) {
190- pInfo->m_addrRemote .SetIPv4 (network->getIP (connect_socket->second .remote_identity .GetSteamID ()), connect_socket->first );
190+ pInfo->m_addrRemote .SetIPv4 (network->getIP (connect_socket->second .remote_identity .GetSteamID ()), connect_socket->second . real_port );
191191 }
192192
193193 pInfo->m_idPOPRemote = 0 ;
@@ -201,6 +201,25 @@ void Steam_Networking_Sockets::set_steamnetconnectioninfo(std::map<HSteamNetConn
201201 // keep this in mind in future interface updates
202202}
203203
204+ void Steam_Networking_Sockets::set_steamnetconnectioninfo_001 (std::map<HSteamNetConnection, Connect_Socket>::iterator connect_socket, SteamNetConnectionInfo001_t* pInfo)
205+ {
206+ pInfo->m_steamIDRemote = connect_socket->second .remote_identity .GetSteamID ();
207+ pInfo->m_nUserData = connect_socket->second .user_data ;
208+ pInfo->m_hListenSocket = connect_socket->second .listen_socket_id ;
209+ if (connect_socket->second .real_port != SNS_DISABLED_PORT) {
210+ pInfo->m_unIPRemote = network->getIP (connect_socket->second .remote_identity .GetSteamID ());
211+ pInfo->m_unPortRemote = connect_socket->second .real_port ;
212+ }
213+
214+ pInfo->m_idPOPRemote = 0 ;
215+ pInfo->m_idPOPRelay = 0 ;
216+ pInfo->m_eState = convert_status (connect_socket->second .status );
217+ pInfo->m_eEndReason = 0 ; // TODO
218+ pInfo->m_szEndDebug [0 ] = 0 ;
219+ // Note some games might not allocate a struct the whole size of SteamNetConnectionInfo_t when calling GetConnectionInfo
220+ // keep this in mind in future interface updates
221+ }
222+
204223void Steam_Networking_Sockets::launch_callback (HSteamNetConnection m_hConn, enum connect_socket_status old_status)
205224{
206225 auto connect_socket = sbcs->connect_sockets .find (m_hConn);
@@ -576,7 +595,7 @@ bool Steam_Networking_Sockets::CloseListenSocket( HSteamListenSocket hSocket, co
576595{
577596 PRINT_DEBUG (" old" );
578597 std::lock_guard<std::recursive_mutex> lock (global_mutex);
579- return false ;
598+ return CloseListenSocket (hSocket) ;
580599}
581600
582601// / Destroy a listen socket. All the connections that were accepting on the listen
@@ -892,7 +911,7 @@ int Steam_Networking_Sockets::ReceiveMessagesOnListenSocket( HSteamListenSocket
892911// / Returns basic information about the high-level state of the connection.
893912bool Steam_Networking_Sockets::GetConnectionInfo ( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo )
894913{
895- PRINT_DEBUG_ENTRY ( );
914+ PRINT_DEBUG ( " %u %i " , hConn, pInfo == NULL );
896915 std::lock_guard<std::recursive_mutex> lock (global_mutex);
897916 if (!pInfo) return false ;
898917
@@ -993,9 +1012,16 @@ int Steam_Networking_Sockets::ReceiveMessagesOnListenSocket( HSteamListenSocket
9931012// / Returns information about the specified connection.
9941013bool Steam_Networking_Sockets::GetConnectionInfo ( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo )
9951014{
996- PRINT_DEBUG_TODO ( );
1015+ PRINT_DEBUG ( " 001 %u %i " , hConn, pInfo == NULL );
9971016 std::lock_guard<std::recursive_mutex> lock (global_mutex);
998- return false ;
1017+
1018+ if (!pInfo) return false ;
1019+
1020+ auto connect_socket = sbcs->connect_sockets .find (hConn);
1021+ if (connect_socket == sbcs->connect_sockets .end ()) return false ;
1022+
1023+ set_steamnetconnectioninfo_001 (connect_socket, pInfo);
1024+ return true ;
9991025}
10001026
10011027
0 commit comments