diff options
Diffstat (limited to 'src/command_queue.lua')
-rw-r--r-- | src/command_queue.lua | 12 |
1 files changed, 9 insertions, 3 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() |