summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-12-26 17:48:04 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-12-26 17:48:04 +0000
commit701c4fc91e2e4d1898adc2cd168da11a5fd7c6a4 (patch)
tree0ef191219c11d6e5b5ef0fb5a0564a2557be4ea9
parentmodule load path is now configurable at build time (diff)
ignoring expected response for output only modules
git-svn-id: https://svn.spreadspace.org/gcsd/trunk@77 ac14a137-c7f1-4531-abe0-07747231d213
-rw-r--r--src/command_queue.lua12
-rw-r--r--src/modules/debug_shell.lua4
-rw-r--r--src/modules/dummy.lua2
-rw-r--r--src/modules/exec.lua2
-rw-r--r--src/modules/stdio.lua2
-rw-r--r--src/modules/stdout.lua3
6 files changed, 15 insertions, 10 deletions
diff --git a/src/command_queue.lua b/src/command_queue.lua
index 2c8b10d..041e63a 100644
--- a/src/command_queue.lua
+++ b/src/command_queue.lua
@@ -42,7 +42,11 @@ function command_queue:enqueue(command, expected_response, timeout)
local new_cmd = {}
new_cmd.command = command
new_cmd.sent = false
- new_cmd.expected_response = expected_response
+ if(expected_response and module_list.output.class.properties.type == defines.OUT_MODULE) then
+ log.printf(log.WARNING, "output module doesn't support responses, ignoring expected response");
+ else
+ new_cmd.expected_response = expected_response
+ end
if(timeout) then
new_cmd.timeout = timer.new(timeout)
end
@@ -63,7 +67,7 @@ function command_queue:get_expected_response()
return self.current.expected_response
end
-function command_queue:get_next_command()
+function command_queue:get_next_command()
if(self.current ~= nil) then return nil end
self.current = self.commands[1]
@@ -81,7 +85,9 @@ function command_queue:command_sent()
return self.current.expected_response
end
- self:command_completed()
+ if(not self.current.expiration_time) then
+ self:command_completed()
+ end
end
function command_queue:check_timeout()
diff --git a/src/modules/debug_shell.lua b/src/modules/debug_shell.lua
index 318c539..85ea4b6 100644
--- a/src/modules/debug_shell.lua
+++ b/src/modules/debug_shell.lua
@@ -41,7 +41,7 @@ debug_shell.next_id = 0
-- create new instance of debug shell module class
function debug_shell:new(config, runtype)
local inst = {}
- inst.class = self.properties.name
+ inst.class = self
inst.config = config
if(config.name == nil or config.name == "") then
inst.name = self.properties.name .. self.next_id
@@ -241,7 +241,7 @@ function debug_shell:exec_cmd(socket)
if(not param or param == '') then socket.out_buffer = socket.out_buffer .. "Error: please specify a command\n"
else
socket.out_buffer = socket.out_buffer .. "enqueing command: " .. param .. "\n"
- command_queue:enqueue(param, "ok\n", 10000)
+ command_queue:enqueue(param, "ok\n", 2500)
end
else
socket.out_buffer = socket.out_buffer .. "unknown command\n"
diff --git a/src/modules/dummy.lua b/src/modules/dummy.lua
index 78cd6c2..96d6a1a 100644
--- a/src/modules/dummy.lua
+++ b/src/modules/dummy.lua
@@ -38,7 +38,7 @@ dummy.next_id = 0
-- create new instance of dummy module class
function dummy:new(config, runtype)
local inst = {}
- inst.class = self.properties.name
+ inst.class = self
inst.config = config
if(config.name == nil or config.name == "") then
inst.name = self.properties.name .. self.next_id
diff --git a/src/modules/exec.lua b/src/modules/exec.lua
index fb2a328..c034c79 100644
--- a/src/modules/exec.lua
+++ b/src/modules/exec.lua
@@ -39,7 +39,7 @@ exec.next_id = 0
-- create new instance of exec module class
function exec:new(config, runtype)
local inst = {}
- inst.class = self.properties.name
+ inst.class = self
inst.config = config
inst.config.runtype = runtype
if(config.name == nil or config.name == "") then
diff --git a/src/modules/stdio.lua b/src/modules/stdio.lua
index cf011ef..0406844 100644
--- a/src/modules/stdio.lua
+++ b/src/modules/stdio.lua
@@ -37,7 +37,7 @@ stdio.properties = { type=defines.INOUT_MODULE, name="stdio", max_instances=1 }
-- create new instance of stdio module class
function stdio:new(config, runtype)
local inst = {}
- inst.class = self.properties.name
+ inst.class = self
inst.config = config
inst.config.runtype = runtype
if(config.name == nil or config.name == "") then
diff --git a/src/modules/stdout.lua b/src/modules/stdout.lua
index 77ae029..3a3d477 100644
--- a/src/modules/stdout.lua
+++ b/src/modules/stdout.lua
@@ -37,7 +37,7 @@ stdout.properties = { type=defines.OUT_MODULE, name="stdout", max_instances=1 }
-- create new instance of stdout module class
function stdout:new(config, runtype)
local inst = {}
- inst.class = self.properties.name
+ inst.class = self
inst.config = config
if(config.name == nil or config.name == "") then
inst.name = self.properties.name
@@ -63,7 +63,6 @@ function stdout:new(config, runtype)
self.out_buffer = string.sub(self.out_buffer, len+1)
if(self.out_buffer == "") then
command_queue:command_sent()
- command_queue:command_completed()
end
return defines.OK
end