Skip to content

Commit de92f3c

Browse files
committed
fix(buffered): properly calculate the remainder to be read
1 parent f8411de commit de92f3c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mqtt/connector/base/buffered_base.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function buffered:receive(size)
4646

4747
while size > (#buf - idx) do
4848
-- buffer is lacking bytes, read more...
49-
local data, err = self:plain_receive(#buf - idx + size)
49+
local data, err = self:plain_receive(size - (#buf - idx))
5050
if not data then
5151
if err == self.signal_idle then
5252
-- read timedout, retry entire packet later, reset buffer

0 commit comments

Comments
 (0)