diegonehab/luasocket — pull request #54 by moteus (2013-06-11 11:30:52+00:00)
Title: Change. socket:setfd() set `fd` to invalid value. 

This is alternative to `acceptfd` method.

Change. socket:setfd() set `fd` to invalid value.
Change. socket:setfd return previews `fd` value.
Change. socket.tcp and socket.udp can create object based on `fd`.

Add. test setfd
```lua
---- server.lua
cli = assert(srv:accept())
-- test if worker thread take ownership and clear `fd`
if run_worker_thread(cli:getfd()) then cli:setfd() end
cli:close()

---- worker.lua
-- wrap raw `fd` to socket object
local sock = socket.tcp(..., "client")
-- do work with sock object
```