aboutsummaryrefslogtreecommitdiffstats
path: root/luaevent/test/test.lua
diff options
context:
space:
mode:
authorThomas Harning Jr <harningt@gmail.com>2007-06-13 04:32:12 +0000
committerThomas Harning Jr <harningt@gmail.com>2007-06-13 04:32:12 +0000
commitdbea9370eb58cdc3cbd1b12d8c8735582370cd6e (patch)
tree80526dffa240d3eca832114e98490f9632925176 /luaevent/test/test.lua
parenta309c7952c6ae1b9ad9c9c0c0d895e1ad969cb95 (diff)
downloadluaevent-prosody-dbea9370eb58cdc3cbd1b12d8c8735582370cd6e.tar.gz
luaevent-prosody-dbea9370eb58cdc3cbd1b12d8c8735582370cd6e.zip
Setup management of socket create/close.
Recognized new bug: cannot create threads within threads... C contains reference to closed thread, not global.
Diffstat (limited to 'luaevent/test/test.lua')
-rw-r--r--luaevent/test/test.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/luaevent/test/test.lua b/luaevent/test/test.lua
index f7a44da..fd9919d 100644
--- a/luaevent/test/test.lua
+++ b/luaevent/test/test.lua
@@ -8,12 +8,13 @@ require"socket"
local function echoHandler(skt)
while true do
local data,ret = luaevent.receive(skt, 10)
- if data == "quit" or ret == 'closed' then
+ if data == "quit" or ret == 'closed' or not data then
break
end
--collectgarbage()
- luaevent.send(skt, data)
+ if not luaevent.send(skt, data) then return end
end
+ if skt then skt:close() end
end
local server = assert(socket.bind("localhost", 20000))