summaryrefslogtreecommitdiff
path: root/nopsyncd/tcpserver.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nopsyncd/tcpserver.lua')
-rwxr-xr-xnopsyncd/tcpserver.lua25
1 files changed, 24 insertions, 1 deletions
diff --git a/nopsyncd/tcpserver.lua b/nopsyncd/tcpserver.lua
index e7df4e5..ff338ac 100755
--- a/nopsyncd/tcpserver.lua
+++ b/nopsyncd/tcpserver.lua
@@ -22,5 +22,28 @@ require "socket"
function main_loop()
- socket.select(nil, nil, 10)
+ local pipefd = pipe.getreadfd()
+
+ while true do
+ local readable, _, err = socket.select({ pipefd } , nil)
+ if(err) then
+ print("select returned with error: " .. err)
+ return -1
+ else
+ for _, input in ipairs(readable) do
+ if(input == pipefd) then
+ local ret = pipe.consume()
+ if ret == 1 then
+ print("pipe was signaled")
+ else
+ return ret
+ end
+ else
+ print("select returned unknown file descriptor!?")
+ end
+ end
+ end
+ end
+
+ return 0
end \ No newline at end of file