Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dll/dll/steam_networking_sockets.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public ISteamNetworkingSockets
ESteamNetworkingConnectionState convert_status(enum connect_socket_status old_status);

void set_steamnetconnectioninfo(std::map<HSteamNetConnection, Connect_Socket>::iterator connect_socket, SteamNetConnectionInfo_t *pInfo);
void set_steamnetconnectioninfo_001(std::map<HSteamNetConnection, Connect_Socket>::iterator connect_socket, SteamNetConnectionInfo001_t* pInfo);


void launch_callback(HSteamNetConnection m_hConn, enum connect_socket_status old_status);

Expand Down
36 changes: 31 additions & 5 deletions dll/steam_networking_sockets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void Steam_Networking_Sockets::set_steamnetconnectioninfo(std::map<HSteamNetConn
pInfo->m_hListenSocket = connect_socket->second.listen_socket_id;
pInfo->m_addrRemote.Clear(); //TODO
if (connect_socket->second.real_port != SNS_DISABLED_PORT) {
pInfo->m_addrRemote.SetIPv4(network->getIP(connect_socket->second.remote_identity.GetSteamID()), connect_socket->first);
pInfo->m_addrRemote.SetIPv4(network->getIP(connect_socket->second.remote_identity.GetSteamID()), connect_socket->second.real_port);
}

pInfo->m_idPOPRemote = 0;
Expand All @@ -201,6 +201,25 @@ void Steam_Networking_Sockets::set_steamnetconnectioninfo(std::map<HSteamNetConn
//keep this in mind in future interface updates
}

void Steam_Networking_Sockets::set_steamnetconnectioninfo_001(std::map<HSteamNetConnection, Connect_Socket>::iterator connect_socket, SteamNetConnectionInfo001_t* pInfo)
{
pInfo->m_steamIDRemote = connect_socket->second.remote_identity.GetSteamID();
pInfo->m_nUserData = connect_socket->second.user_data;
pInfo->m_hListenSocket = connect_socket->second.listen_socket_id;
if (connect_socket->second.real_port != SNS_DISABLED_PORT) {
pInfo->m_unIPRemote = network->getIP(connect_socket->second.remote_identity.GetSteamID());
pInfo->m_unPortRemote = connect_socket->second.real_port;
}

pInfo->m_idPOPRemote = 0;
pInfo->m_idPOPRelay = 0;
pInfo->m_eState = convert_status(connect_socket->second.status);
pInfo->m_eEndReason = 0; //TODO
pInfo->m_szEndDebug[0] = 0;
//Note some games might not allocate a struct the whole size of SteamNetConnectionInfo_t when calling GetConnectionInfo
//keep this in mind in future interface updates
}

void Steam_Networking_Sockets::launch_callback(HSteamNetConnection m_hConn, enum connect_socket_status old_status)
{
auto connect_socket = sbcs->connect_sockets.find(m_hConn);
Expand Down Expand Up @@ -576,7 +595,7 @@ bool Steam_Networking_Sockets::CloseListenSocket( HSteamListenSocket hSocket, co
{
PRINT_DEBUG("old");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return false;
return CloseListenSocket(hSocket);
}

/// Destroy a listen socket. All the connections that were accepting on the listen
Expand Down Expand Up @@ -892,7 +911,7 @@ int Steam_Networking_Sockets::ReceiveMessagesOnListenSocket( HSteamListenSocket
/// Returns basic information about the high-level state of the connection.
bool Steam_Networking_Sockets::GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo )
{
PRINT_DEBUG_ENTRY();
PRINT_DEBUG("%u %i", hConn, pInfo == NULL);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
if (!pInfo) return false;

Expand Down Expand Up @@ -993,9 +1012,16 @@ int Steam_Networking_Sockets::ReceiveMessagesOnListenSocket( HSteamListenSocket
/// Returns information about the specified connection.
bool Steam_Networking_Sockets::GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo001_t *pInfo )
{
PRINT_DEBUG_TODO();
PRINT_DEBUG("001 %u %i", hConn, pInfo == NULL);
std::lock_guard<std::recursive_mutex> lock(global_mutex);
return false;

if (!pInfo) return false;

auto connect_socket = sbcs->connect_sockets.find(hConn);
if (connect_socket == sbcs->connect_sockets.end()) return false;

set_steamnetconnectioninfo_001(connect_socket, pInfo);
return true;
}


Expand Down