Skip to content
Snippets Groups Projects
Commit fcc02b66 authored by Dmitry E. Oboukhov's avatar Dmitry E. Oboukhov
Browse files

net.box checks the first argument in its methods. closes #544

parent ce3d565f
No related branches found
No related tags found
No related merge requests found
......@@ -391,6 +391,9 @@ local remote_methods = {
ping = function(self)
if type(self) ~= 'table' then
box.error(box.error.PROC_LUA, "usage: remote:call(proc_name, ...)")
end
if not self:is_connected() then
return false
end
......@@ -411,6 +414,10 @@ local remote_methods = {
end,
call = function(self, proc_name, ...)
if type(self) ~= 'table' then
box.error(box.error.PROC_LUA, "usage: remote:call(proc_name, ...)")
end
proc_name = tostring(proc_name)
if not self.console then
......@@ -1077,6 +1084,9 @@ remote.self = {
timeout = function(self) return self end,
wait_connected = function(self) return true end,
call = function(_box, proc_name, ...)
if type(_box) ~= 'table' then
box.error(box.error.PROC_LUA, "usage: remote:call(proc_name, ...)")
end
proc_name = tostring(proc_name)
local proc = { package.loaded['box.internal']
.call_loadproc(proc_name) }
......
......@@ -582,3 +582,24 @@ remote:new(LISTEN.host, LISTEN.service, { password = 'test' })
---
- error: 'net.box: user is not defined'
...
-- #544 usage for remote[point]method
cn:call('console_test')
---
- - []
...
cn.call('console_test')
---
- error: 'usage: remote:call(proc_name, ...)'
...
cn.ping()
---
- error: 'usage: remote:call(proc_name, ...)'
...
remote.self:call('console_test')
---
- []
...
remote.self.call('console_test')
---
- error: 'usage: remote:call(proc_name, ...)'
...
......@@ -229,3 +229,12 @@ cnc:call('123')
remote:new(LISTEN.host, LISTEN.service, { user = 'test' })
remote:new(LISTEN.host, LISTEN.service, { password = 'test' })
-- #544 usage for remote[point]method
cn:call('console_test')
cn.call('console_test')
cn.ping()
remote.self:call('console_test')
remote.self.call('console_test')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment