Commit graph

1 commit

Author SHA1 Message Date
moteus
3520727490 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
  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
  -- wrap raw `fd` to socket object
  local sock = socket.tcp(..., "client")
  -- do work with sock object
```
2013-06-10 12:05:34 +04:00