@@ -36,7 +36,7 @@ static struct PacketCallbackQueueNode* const wait_for_next_packet_callback(struc
3636 return node_to_process ;
3737}
3838
39- void execute_packet_callback (struct PacketCallbackQueue * const queue , void (* const _Atomic * const packet_handler ) (void * const ), const enum ConnectionType connection_type , struct SwiftNetMemoryAllocator * const pending_message_memory_allocator , _Atomic bool * closing , void * const connection , struct SwiftNetVector * const pending_messages ) {
39+ void execute_packet_callback (struct PacketCallbackQueue * const queue , void (* const _Atomic * const packet_handler ) (void * const , void * const ), const enum ConnectionType connection_type , struct SwiftNetMemoryAllocator * const pending_message_memory_allocator , _Atomic bool * closing , void * const connection , struct SwiftNetVector * const pending_messages , _Atomic ( void * ) * user_data ) {
4040 while (1 ) {
4141 if (atomic_load_explicit (closing , memory_order_acquire ) == true) {
4242 break ;
@@ -67,7 +67,7 @@ void execute_packet_callback(struct PacketCallbackQueue* const queue, void (* co
6767 vector_unlock (pending_messages );
6868 }
6969
70- void (* const packet_handler_loaded )(void * ) = atomic_load (packet_handler );
70+ void (* const packet_handler_loaded )(void * const , void * const ) = atomic_load (packet_handler );
7171 if (unlikely (packet_handler_loaded == NULL )) {
7272 if (connection_type == CONNECTION_TYPE_CLIENT ) {
7373 swiftnet_client_destroy_packet_data (node -> packet_data , connection );
@@ -80,7 +80,7 @@ void execute_packet_callback(struct PacketCallbackQueue* const queue, void (* co
8080 continue ;
8181 }
8282
83- (* packet_handler_loaded )(node -> packet_data );
83+ (* packet_handler_loaded )(node -> packet_data , atomic_load_explicit ( user_data , memory_order_acquire ) );
8484
8585 allocator_free (& packet_callback_queue_node_memory_allocator , (void * )node );
8686 }
@@ -89,15 +89,15 @@ void execute_packet_callback(struct PacketCallbackQueue* const queue, void (* co
8989void * execute_packet_callback_client (void * const void_client ) {
9090 struct SwiftNetClientConnection * const client = void_client ;
9191
92- execute_packet_callback (& client -> packet_callback_queue , (void * )& client -> packet_handler , CONNECTION_TYPE_CLIENT , & client -> pending_messages_memory_allocator , & client -> closing , void_client , & client -> pending_messages );
92+ execute_packet_callback (& client -> packet_callback_queue , (void * )& client -> packet_handler , CONNECTION_TYPE_CLIENT , & client -> pending_messages_memory_allocator , & client -> closing , void_client , & client -> pending_messages , & client -> packet_handler_user_arg );
9393
9494 return NULL ;
9595}
9696
9797void * execute_packet_callback_server (void * const void_server ) {
9898 struct SwiftNetServer * const server = void_server ;
9999
100- execute_packet_callback (& server -> packet_callback_queue , (void * )& server -> packet_handler , CONNECTION_TYPE_SERVER , & server -> pending_messages_memory_allocator , & server -> closing , void_server , & server -> pending_messages );
100+ execute_packet_callback (& server -> packet_callback_queue , (void * )& server -> packet_handler , CONNECTION_TYPE_SERVER , & server -> pending_messages_memory_allocator , & server -> closing , void_server , & server -> pending_messages , & server -> packet_handler_user_arg );
101101
102102 return NULL ;
103103}
0 commit comments