diff options
author | Christian Pointner <equinox@spreadspace.org> | 2010-11-09 14:29:07 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2010-11-09 14:29:07 +0000 |
commit | b1c1dcaa1db38b20322bb80e97d6952de568f226 (patch) | |
tree | c500cfc2c7d6b727d7675aa4e16a22de3c1105d4 | |
parent | fixed client cleanup at write error (diff) |
variables name refactored
added TODO for partial writes
git-svn-id: https://svn.spreadspace.org/gcsd/trunk@21 ac14a137-c7f1-4531-abe0-07747231d213
-rw-r--r-- | src/main_loop.lua | 18 | ||||
-rw-r--r-- | src/modules/debug_shell.lua | 1 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/main_loop.lua b/src/main_loop.lua index 7c745f2..28681df 100644 --- a/src/main_loop.lua +++ b/src/main_loop.lua @@ -79,28 +79,28 @@ function main_loop(opt) log.printf(log.ERROR, "select returned with error: %s", err) return_value = -1 else - for _, input in ipairs(readable) do - if(input == sig) then + for _, reader in ipairs(readable) do + if(reader == sig) then return_value = signal.handle() if(return_value == 1) then break end else - local ret = input:read() + local ret = reader:read() if(ret == defines.KILL_DAEMON) then return_value = 2 break elseif(ret == defines.KILL_MODULE_TYPE) then - module_list:unregister_by_type(input.client_instance.module_instance.type) + module_list:unregister_by_type(reader.client_instance.module_instance.type) elseif(ret == defines.KILL_MODULE) then - module_list:unregister(input.client_instance.module_instance) + module_list:unregister(reader.client_instance.module_instance) elseif(ret == defines.KILL_CLIENT) then - client_list:unregister(input.client_instance) + client_list:unregister(reader.client_instance) end end end - for _, output in ipairs(writeable) do - ret = output:write() + for _, writer in ipairs(writeable) do + ret = writer:write() if(ret == defines.KILL_CLIENT) then - client_list:unregister(input.client_instance) + client_list:unregister(writer.client_instance) end end end diff --git a/src/modules/debug_shell.lua b/src/modules/debug_shell.lua index 70b242a..0cdf191 100644 --- a/src/modules/debug_shell.lua +++ b/src/modules/debug_shell.lua @@ -120,6 +120,7 @@ function debug_shell:new(config) return ret end function client_sock:write() + -- TODO: test return value and handle partial writes self.sock:send(self.out_buffer) self.out_buffer = "" return defines.OK |