Added thread safe packet handlers

This commit is contained in:
2024-02-28 13:23:17 +01:00
parent cb4dd41358
commit db3ee3a685
11 changed files with 37 additions and 16 deletions

View File

@ -21,9 +21,5 @@ func handle_packet(packet: PackedByteArray):
push_warning("Unknown packet type %d" % type)
return
if handler.thread_safe:
handler.handle_packet(packet.slice(1))
else:
handler.handle_packet.call_deferred(packet.slice(1))
handler.handle_packet(packet.slice(1))
download += packet.size()

View File

@ -16,7 +16,5 @@ enum Packet {
@export var packet_type: Packet
var thread_safe: bool
func handle_packet(_data: PackedByteArray):
pass