diff options
| author | ruki <[email protected]> | 2022-04-07 23:05:34 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-07 23:05:34 +0800 |
| commit | 102b2c2b5d33b31ee7660e77fcbacac9bc5677a4 (patch) | |
| tree | 104c417bed8eeb9c2e058fb368a8e2f96c1084b2 | |
| parent | e930a2db6840d9a6f501d4231889e045ba09d7d3 (diff) | |
fix stream recv
| -rw-r--r-- | xmake/core/base/bytes.lua | 8 | ||||
| -rw-r--r-- | xmake/modules/private/service/server/server.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/service/stream.lua | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/xmake/core/base/bytes.lua b/xmake/core/base/bytes.lua index 48a93cde8..daf51bc81 100644 --- a/xmake/core/base/bytes.lua +++ b/xmake/core/base/bytes.lua @@ -310,11 +310,13 @@ function _instance:clone() end -- dump whole bytes data -function _instance:dump() +function _instance:dump(start, last) + start = start or 1 + last = last or self:size() local i = 0 local n = 147 - local p = 0 - local e = self:size() + local p = start - 1 + local e = last local line = nil while p < e do line = "" diff --git a/xmake/modules/private/service/server/server.lua b/xmake/modules/private/service/server/server.lua index 95db2f5a5..534a2da15 100644 --- a/xmake/modules/private/service/server/server.lua +++ b/xmake/modules/private/service/server/server.lua @@ -124,7 +124,7 @@ function server:_handle_session(sock) while true do local data = rstream:recv_string() if data then - print("|%s|", data) + print("%s", data) else break end diff --git a/xmake/modules/private/service/stream.lua b/xmake/modules/private/service/stream.lua index 5460a7cb9..226ee22e0 100644 --- a/xmake/modules/private/service/stream.lua +++ b/xmake/modules/private/service/stream.lua @@ -144,7 +144,7 @@ function stream:recv(buff, size) -- move left cache to head cache_size = real - leftsize if cache_size > 0 then - cache:move(leftsize, cache_size) + cache:move(leftsize + 1, real) end self._RCACHE_SIZE = cache_size return buff:slice(1, buffsize) |
