summaryrefslogtreecommitdiff
path: root/xmake/core/base/socket.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-06-16 00:29:09 +0800
committerruki <[email protected]>2022-06-16 00:29:09 +0800
commitea89ffdb54ecc2bfb34f7a3162f216207ddf13ff (patch)
tree38fdd8da9cb4fea8bd320be2c27c1a24287180ea /xmake/core/base/socket.lua
parent78e01e055477f407d6782075ae5cf6de0abf38f5 (diff)
improve to send/recv empty file
Diffstat (limited to 'xmake/core/base/socket.lua')
-rw-r--r--xmake/core/base/socket.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/xmake/core/base/socket.lua b/xmake/core/base/socket.lua
index 9a36c45a8..615f28a0c 100644
--- a/xmake/core/base/socket.lua
+++ b/xmake/core/base/socket.lua
@@ -353,6 +353,11 @@ function _instance:sendfile(file, opt)
return -1, errors
end
+ -- empty file?
+ if file:size() == 0 then
+ return -1, string.format("%s: send empty file!", self)
+ end
+
-- init start and last
opt = opt or {}
local start = opt.start or 1