mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
binder.rb - move logger.log calls after adding listeners
Other threads may be writing to sockets based on logger.log calls, so they must be after the listeners are available
This commit is contained in:
parent
d639760c24
commit
69d4c6391d
1 changed files with 8 additions and 9 deletions
|
@ -90,19 +90,19 @@ module Puma
|
|||
case uri.scheme
|
||||
when "tcp"
|
||||
if fd = @inherited_fds.delete(str)
|
||||
logger.log "* Inherited #{str}"
|
||||
io = inherit_tcp_listener uri.host, uri.port, fd
|
||||
logger.log "* Inherited #{str}"
|
||||
elsif sock = @activated_sockets.delete([ :tcp, uri.host, uri.port ])
|
||||
logger.log "* Activated #{str}"
|
||||
io = inherit_tcp_listener uri.host, uri.port, sock
|
||||
logger.log "* Activated #{str}"
|
||||
else
|
||||
params = Util.parse_query uri.query
|
||||
|
||||
opt = params.key?('low_latency')
|
||||
bak = params.fetch('backlog', 1024).to_i
|
||||
|
||||
logger.log "* Listening on #{str}"
|
||||
io = add_tcp_listener uri.host, uri.port, opt, bak
|
||||
logger.log "* Listening on #{str}"
|
||||
end
|
||||
|
||||
@listeners << [str, io] if io
|
||||
|
@ -110,14 +110,12 @@ module Puma
|
|||
path = "#{uri.host}#{uri.path}".gsub("%20", " ")
|
||||
|
||||
if fd = @inherited_fds.delete(str)
|
||||
logger.log "* Inherited #{str}"
|
||||
io = inherit_unix_listener path, fd
|
||||
logger.log "* Inherited #{str}"
|
||||
elsif sock = @activated_sockets.delete([ :unix, path ])
|
||||
logger.log "* Activated #{str}"
|
||||
io = inherit_unix_listener path, sock
|
||||
logger.log "* Activated #{str}"
|
||||
else
|
||||
logger.log "* Listening on #{str}"
|
||||
|
||||
umask = nil
|
||||
mode = nil
|
||||
backlog = 1024
|
||||
|
@ -139,6 +137,7 @@ module Puma
|
|||
end
|
||||
|
||||
io = add_unix_listener path, umask, mode, backlog
|
||||
logger.log "* Listening on #{str}"
|
||||
end
|
||||
|
||||
@listeners << [str, io]
|
||||
|
@ -204,11 +203,11 @@ module Puma
|
|||
logger.log "* Inherited #{str}"
|
||||
io = inherit_ssl_listener fd, ctx
|
||||
elsif sock = @activated_sockets.delete([ :tcp, uri.host, uri.port ])
|
||||
logger.log "* Activated #{str}"
|
||||
io = inherit_ssl_listener sock, ctx
|
||||
logger.log "* Activated #{str}"
|
||||
else
|
||||
logger.log "* Listening on #{str}"
|
||||
io = add_ssl_listener uri.host, uri.port, ctx
|
||||
logger.log "* Listening on #{str}"
|
||||
end
|
||||
|
||||
@listeners << [str, io] if io
|
||||
|
|
Loading…
Reference in a new issue