lsteamclient: Queue callback for networking SetConfigValue functions.

CW-Bug-Id: #22729
This commit is contained in:
Rémi Bernon 2023-10-03 11:01:47 +02:00 committed by Arkadiusz Hiler
parent 5a552fbe77
commit 6a7dbe6160
5 changed files with 67 additions and 53 deletions

View file

@ -103,6 +103,26 @@ static void u_steam_networking_socket_debug_output( uint32_t nType, const char *
pthread_mutex_unlock( &callbacks_lock );
}
void queue_cdecl_func_callback( w_cdecl_func func, void *data, uint32_t data_size )
{
uint32_t size = data_size;
struct callback_entry *entry;
size += sizeof(struct callback_entry);
if (!(entry = (struct callback_entry *)malloc( size ))) return;
entry->callback.type = CALL_CDECL_FUNC_DATA;
size -= offsetof( struct callback_entry, callback );
entry->callback.size = size;
entry->callback.call_cdecl_func_data.pFunc = func;
memcpy( (char *)entry->callback.call_cdecl_func_data.data, data, data_size );
pthread_mutex_lock( &callbacks_lock );
list_add_tail( &callbacks, &entry->entry );
pthread_mutex_unlock( &callbacks_lock );
}
u_FSteamNetworkingSocketsDebugOutput manual_convert_SetDebugOutputFunction_pfnFunc( w_FSteamNetworkingSocketsDebugOutput w_func )
{
w_steam_networking_socket_debug_output = w_func;