diff options
| author | ruki <[email protected]> | 2022-07-05 23:07:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-07-05 23:07:51 +0800 |
| commit | c94c4d9aa8fe72a25358e89fa608f3457e9ee1f7 (patch) | |
| tree | 5c00acd7ef42c0dfce82d1f17f5f1405b6d9c5c9 /xmake/modules | |
| parent | 61d5d3faef3360303c862a4db2e7101e17ac6aac (diff) | |
checkout timeout errors
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/private/service/stream.lua | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/modules/private/service/stream.lua b/xmake/modules/private/service/stream.lua index 9037bdd8b..e7972e7e9 100644 --- a/xmake/modules/private/service/stream.lua +++ b/xmake/modules/private/service/stream.lua @@ -101,6 +101,7 @@ function stream:send(data, start, last) -- send data to socket local sock = self._SOCK local real = sock:send(cache, {block = true, timeout = self:timeout()}) + print("send", real) if real > 0 then -- copy left data to cache assert(size <= cache_maxn) @@ -287,9 +288,11 @@ function stream:recv(buff, size) end wait = false elseif real == 0 and not wait then - if sock:wait(socket.EV_RECV, self:timeout()) == socket.EV_RECV then + local ok = sock:wait(socket.EV_RECV, self:timeout()) + if ok == socket.EV_RECV then wait = true else + assert(ok ~= 0, "%s: recv timeout!", self) break end else @@ -449,6 +452,10 @@ function stream:_recv_compressed_file(lz4_stream, filepath, size) end end +function stream:__tostring() + return string.format("<stream: %s>", self:sock()) +end + function main(sock, opt) local instance = stream() instance:init(sock, opt) |
