diff --git a/src/lua/box_net_box.lua b/src/lua/box_net_box.lua index 31adf5785d1554d29c043a1c705cd1bf9f52bc89..cef696ed4d8424f9cf912c1128b2bc463196cc2e 100644 --- a/src/lua/box_net_box.lua +++ b/src/lua/box_net_box.lua @@ -517,11 +517,12 @@ local remote_methods = { end local len, off = msgpack.decode(self.rbuf) - - if len < #self.rbuf - off then - return + -- wait for correct package length + if len + off - 1 > #self.rbuf then + break end + local hdr, body hdr, off = msgpack.decode(self.rbuf, off) if off < #self.rbuf then diff --git a/test/box/box.net.box.result b/test/box/box.net.box.result index c3bfff51de0265b9d0c63c8044b6a4938ae6a666..f3e7a5da7c3f5043ed9d8cb67621005ec39ee638 100644 --- a/test/box/box.net.box.result +++ b/test/box/box.net.box.result @@ -382,6 +382,35 @@ cn:call('test_foo', 'a', 'b', 'c') - [{'b': 2}] - ['c'] ... +-- long replies +function long_rep() return { 1, string.rep('a', 5000) } end +--- +... +res = cn:call('long_rep') +--- +... +res[1][1] == 1 +--- +- true +... +res[1][2] == string.rep('a', 5000) +--- +- true +... +function long_rep() return { 1, string.rep('a', 50000) } end +--- +... +res = cn:call('long_rep') +--- +... +res[1][1] == 1 +--- +- true +... +res[1][2] == string.rep('a', 50000) +--- +- true +... -- auth cn.proto.b64decode('gJLocxbO32VmfO8x04xRVxKfgwzmNVM2t6a1ME8XsD0=') --- diff --git a/test/box/box.net.box.test.lua b/test/box/box.net.box.test.lua index 2df3b8f6aae33da5b6f488636ec6b1c69d2aa73c..647a62c6bc2bdac682ab6e6e872d167628e41f45 100644 --- a/test/box/box.net.box.test.lua +++ b/test/box/box.net.box.test.lua @@ -136,11 +136,21 @@ cn:call('test_foo', 'a', 'b', 'c') remote.self:call('test_foo', 'a', 'b', 'c') cn:call('test_foo', 'a', 'b', 'c') +-- long replies +function long_rep() return { 1, string.rep('a', 5000) } end +res = cn:call('long_rep') +res[1][1] == 1 +res[1][2] == string.rep('a', 5000) + +function long_rep() return { 1, string.rep('a', 50000) } end +res = cn:call('long_rep') +res[1][1] == 1 +res[1][2] == string.rep('a', 50000) + -- auth cn.proto.b64decode('gJLocxbO32VmfO8x04xRVxKfgwzmNVM2t6a1ME8XsD0=') cn.proto.b64decode('gJLoc!!!!!!!') - cn = remote:new('127.0.0.1', port, { user = 'netbox', password = '123', wait_connected = true }) cn:is_connected() cn.error @@ -172,6 +182,8 @@ remote.self:ping() remote.self.space.net_box_test_space:select{234} remote.self:timeout(123).space.net_box_test_space:select{234} + + -- cleanup database after tests space:drop()