summaryrefslogtreecommitdiff
path: root/src/main_loop.lua
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-11-14 19:06:41 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-11-14 19:06:41 +0000
commitc3b827d710f62be79837dc581c93db9a2f091d15 (patch)
tree29f68f4a3f1a6a72ba6a589dfbe505e2c9b5c907 /src/main_loop.lua
parentchanged module configuration syntax (diff)
added command queue
git-svn-id: https://svn.spreadspace.org/gcsd/trunk@27 ac14a137-c7f1-4531-abe0-07747231d213
Diffstat (limited to 'src/main_loop.lua')
-rw-r--r--src/main_loop.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/main_loop.lua b/src/main_loop.lua
index 5540dee..ebe42fa 100644
--- a/src/main_loop.lua
+++ b/src/main_loop.lua
@@ -35,7 +35,7 @@ local defines = require("defines")
function get_readables()
local readables = {}
- for _, module in ipairs(module_list.modules) do
+ for _, module in ipairs(module_list.inputs) do
for _, fd in ipairs(module:get_read_handles()) do
table.insert(readables, fd)
end
@@ -45,13 +45,13 @@ function get_readables()
table.insert(readables, fd)
end
end
-
+
return readables
end
function get_writeables()
local writeables = { }
- for _, module in ipairs(module_list.modules) do
+ for _, module in ipairs(module_list.inputs) do
for _, fd in ipairs(module:get_write_handles()) do
table.insert(writeables, fd)
end
@@ -61,11 +61,11 @@ function get_writeables()
table.insert(writeables, fd)
end
end
-
+
return writeables
end
-function main_loop(opt)
+function main_loop(opt)
log.printf(log.NOTICE, "main_loop started")
local sig = signal.init()
@@ -85,7 +85,7 @@ function main_loop(opt)
if(return_value == 1) then break end
else
local ret = reader:read()
- if(ret == defines.KILL_DAEMON) then
+ if(ret == defines.KILL_DAEMON) then
return_value = 2
break
elseif(ret == defines.KILL_MODULE_CLASS) then
@@ -103,6 +103,11 @@ function main_loop(opt)
client_list:unregister(writer.client_instance)
end
end
+ if(command_queue:command_pending()) then
+ log.printf(log.DEBUG, "sending pending command: %s", command_queue:get_next_command())
+ command_queue:command_sent()
+ command_queue:command_completed()
+ end
end
end