Don't memset the whole connection status structs to zero.
Some games pass smaller versions of the struct.merge-requests/39/head
parent
19015c097c
commit
b8eae2b709
|
@ -882,17 +882,20 @@ bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pIn
|
||||||
auto connect_socket = connect_sockets.find(hConn);
|
auto connect_socket = connect_sockets.find(hConn);
|
||||||
if (connect_socket == connect_sockets.end()) return false;
|
if (connect_socket == connect_sockets.end()) return false;
|
||||||
|
|
||||||
memset(pInfo, 0, sizeof(SteamNetConnectionInfo_t));
|
|
||||||
pInfo->m_identityRemote = connect_socket->second.remote_identity;
|
pInfo->m_identityRemote = connect_socket->second.remote_identity;
|
||||||
pInfo->m_nUserData = connect_socket->second.user_data;
|
pInfo->m_nUserData = connect_socket->second.user_data;
|
||||||
pInfo->m_hListenSocket = connect_socket->second.listen_socket_id;
|
pInfo->m_hListenSocket = connect_socket->second.listen_socket_id;
|
||||||
//pInfo->m_addrRemote; //TODO
|
pInfo->m_addrRemote.Clear(); //TODO
|
||||||
pInfo->m_idPOPRemote = 0;
|
pInfo->m_idPOPRemote = 0;
|
||||||
pInfo->m_idPOPRelay = 0;
|
pInfo->m_idPOPRelay = 0;
|
||||||
pInfo->m_eState = convert_status(connect_socket->second.status);
|
pInfo->m_eState = convert_status(connect_socket->second.status);
|
||||||
pInfo->m_eEndReason = 0; //TODO
|
pInfo->m_eEndReason = 0; //TODO
|
||||||
pInfo->m_szEndDebug[0] = 0;
|
pInfo->m_szEndDebug[0] = 0;
|
||||||
sprintf(pInfo->m_szConnectionDescription, "%u", hConn);
|
sprintf(pInfo->m_szConnectionDescription, "%u", hConn);
|
||||||
|
|
||||||
|
//Note some games might not allocate a struct the whole size of SteamNetConnectionInfo_t
|
||||||
|
//keep this in mind in future interface updates
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -954,13 +957,21 @@ bool GetQuickConnectionStatus( HSteamNetConnection hConn, SteamNetworkingQuickCo
|
||||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||||
auto connect_socket = connect_sockets.find(hConn);
|
auto connect_socket = connect_sockets.find(hConn);
|
||||||
if (connect_socket == connect_sockets.end()) return false;
|
if (connect_socket == connect_sockets.end()) return false;
|
||||||
memset(pStats, 0, sizeof(SteamNetworkingQuickConnectionStatus));
|
|
||||||
|
|
||||||
pStats->m_eState = convert_status(connect_socket->second.status);
|
pStats->m_eState = convert_status(connect_socket->second.status);
|
||||||
pStats->m_nPing = 10; //TODO: calculate real numbers?
|
pStats->m_nPing = 10; //TODO: calculate real numbers?
|
||||||
pStats->m_flConnectionQualityLocal = 1.0;
|
pStats->m_flConnectionQualityLocal = 1.0;
|
||||||
pStats->m_flConnectionQualityRemote = 1.0;
|
pStats->m_flConnectionQualityRemote = 1.0;
|
||||||
//TODO: rest
|
//TODO: rest
|
||||||
|
pStats->m_flOutPacketsPerSec = 0.0;
|
||||||
|
pStats->m_flOutBytesPerSec = 0.0;
|
||||||
|
pStats->m_flInPacketsPerSec = 0.0;
|
||||||
|
pStats->m_flInBytesPerSec = 0.0;
|
||||||
|
pStats->m_cbSentUnackedReliable = 0.0;
|
||||||
|
pStats->m_usecQueueTime = 0.0;
|
||||||
|
|
||||||
|
//Note some games (volcanoids) might not allocate a struct the whole size of SteamNetworkingQuickConnectionStatus
|
||||||
|
//keep this in mind in future interface updates
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue