You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've an issue in function Res:sendFile() in the local function doSend(): When the file length is a multiple of 512 (1024, 1536, 2048, ...) the function fails at the end of the file, since buf is nil in self._skt:send(buf). Here's how I fixed it:
print('* Sending ', filename)
local pos, fin = 0, nil
local function doSend()
file.open(filename, 'r')
if file.seek('set', pos) == nil then
fin = 1
else
local buf = file.read(512)
pos = pos + 512
if buf == nil then
fin = 1
else
self._skt:send(buf)
end
end
file.close()
if fin then
self:close()
print('* Finished ', filename)
end
end
Great project, thanks for sharing!
The text was updated successfully, but these errors were encountered:
I've an issue in function
Res:sendFile()
in the local functiondoSend()
: When the file length is a multiple of 512 (1024, 1536, 2048, ...) the function fails at the end of the file, sincebuf
is nil inself._skt:send(buf)
. Here's how I fixed it:Great project, thanks for sharing!
The text was updated successfully, but these errors were encountered: