Skip to content

Commit a1efac1

Browse files
authored
Force callback on empty file write (#3313)
1 parent e24bdfe commit a1efac1

File tree

1 file changed

+10
-2
lines changed
  • lua/entities/gmod_wire_expression2/core

1 file changed

+10
-2
lines changed

lua/entities/gmod_wire_expression2/core/files.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ flushFileBuffer = function()
338338
net.Start("wire_expression2_file_download")
339339
net.WriteString(name or "")
340340
net.WriteBool(fdata.append)
341-
net.WriteStream(data, function()
341+
342+
local finished_cb = function()
342343
fdata.downloaded = true
343344
fdata.downloading = false
344345

@@ -354,7 +355,14 @@ flushFileBuffer = function()
354355
if #queue ~= 0 then -- Queue the next file
355356
timer.Create("wire_expression2_flush_file_buffer", 0.2, 2, flushFileBuffer)
356357
end
357-
end)
358+
end
359+
360+
if #data == 0 then
361+
net.WriteUInt(0, 32)
362+
finished_cb()
363+
else
364+
net.WriteStream(data, finished_cb)
365+
end
358366
net.Send(ply)
359367
end
360368
end

0 commit comments

Comments
 (0)