From 049b1771cdd9da9c0db9516deeb07e2abe6b4bcc Mon Sep 17 00:00:00 2001 From: Denneisk <20892685+Denneisk@users.noreply.github.com> Date: Sun, 29 Dec 2024 09:14:13 -0500 Subject: [PATCH 1/2] Mitigate download issues with file extension --- lua/entities/gmod_wire_expression2/core/files.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/files.lua b/lua/entities/gmod_wire_expression2/core/files.lua index 14576471bf..451f9be503 100644 --- a/lua/entities/gmod_wire_expression2/core/files.lua +++ b/lua/entities/gmod_wire_expression2/core/files.lua @@ -325,6 +325,7 @@ util.AddNetworkString("wire_expression2_file_download") -- 2 - Upload -- 3 - End +timer.Remove("wire_expression2_flush_file_buffer") -- Remove this timer in case it exists from reloading flushFileBuffer = function() for ply, queue in pairs(downloads) do if ent_IsValid(ply) then @@ -350,8 +351,12 @@ flushFileBuffer = function() table.remove(queue, 1) - if #queue ~= 0 and not timer.Exists("wire_expression2_flush_file_buffer") then -- Queue the next file - timer.Create("wire_expression2_flush_file_buffer", 0.2, 0, flushFileBuffer) + if #queue ~= 0 then -- Queue the next file + if timer.Exists("wire_expression2_flush_file_buffer") then + timer.Adjust("wire_expression2_flush_file_buffer", 0.2, 2) + else + timer.Create("wire_expression2_flush_file_buffer", 0.2, 2, flushFileBuffer) + end end end) net.Send(ply) From 090f5e64cd07b1ca8056398d9d24be4e7ef76fe0 Mon Sep 17 00:00:00 2001 From: Denneisk <20892685+Denneisk@users.noreply.github.com> Date: Mon, 30 Dec 2024 19:50:21 -0500 Subject: [PATCH 2/2] Simplify timer --- lua/entities/gmod_wire_expression2/core/files.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lua/entities/gmod_wire_expression2/core/files.lua b/lua/entities/gmod_wire_expression2/core/files.lua index 451f9be503..6b3bd8eb84 100644 --- a/lua/entities/gmod_wire_expression2/core/files.lua +++ b/lua/entities/gmod_wire_expression2/core/files.lua @@ -352,11 +352,7 @@ flushFileBuffer = function() table.remove(queue, 1) if #queue ~= 0 then -- Queue the next file - if timer.Exists("wire_expression2_flush_file_buffer") then - timer.Adjust("wire_expression2_flush_file_buffer", 0.2, 2) - else - timer.Create("wire_expression2_flush_file_buffer", 0.2, 2, flushFileBuffer) - end + timer.Create("wire_expression2_flush_file_buffer", 0.2, 2, flushFileBuffer) end end) net.Send(ply)