Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Use actual assigned port
Browse files Browse the repository at this point in the history
Query the assigned port from socket after binding. This allows for using 0
as port to get one assigned from the OS and then query that port. Comes in
handy when using some kind of service registry.
  • Loading branch information
timn authored and mascarenhas committed Aug 17, 2010
1 parent 8ef7b66 commit 1aebe29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/xavante/httpd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,8 @@ end
function register (host, port, serversoftware)
local _server = assert(socket.bind(host, port))
_serversoftware = serversoftware
_serverports[port] = true
local _ip, _port = _server:getsockname()
_serverports[_port] = true
copas.addserver(_server, connection)
end

Expand Down

0 comments on commit 1aebe29

Please sign in to comment.