1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

default unix backlog depth to 1024, fixes #1449 (#1473)

This commit is contained in:
Evan Prothro 2017-11-28 11:11:59 -06:00 committed by Nate Berkopec
parent a85b9025cd
commit e47e8ea040
2 changed files with 18 additions and 5 deletions

View file

@ -120,7 +120,7 @@ module Puma
umask = nil umask = nil
mode = nil mode = nil
backlog = nil backlog = 1024
if uri.query if uri.query
params = Util.parse_query uri.query params = Util.parse_query uri.query
@ -344,7 +344,7 @@ module Puma
# Tell the server to listen on +path+ as a UNIX domain socket. # Tell the server to listen on +path+ as a UNIX domain socket.
# #
def add_unix_listener(path, umask=nil, mode=nil, backlog=nil) def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
@unix_paths << path @unix_paths << path
# Let anyone connect by default # Let anyone connect by default
@ -365,7 +365,7 @@ module Puma
end end
s = UNIXServer.new(path) s = UNIXServer.new(path)
s.listen backlog if backlog s.listen backlog
@ios << s @ios << s
ensure ensure
File.umask old_mask File.umask old_mask

View file

@ -110,9 +110,22 @@ module Puma
@options[:config_files] << file @options[:config_files] << file
end end
# Bind the server to +url+. tcp:// and unix:// are the only accepted # Adds a binding for the server to +url+. tcp://, unix://, and ssl:// are the only accepted
# protocols. # protocols. Use query parameters within the url to specify options.
# #
# @note multiple urls can be bound to, calling `bind` does not overwrite previous bindings.
#
# @example Explicitly the socket backlog depth (default is 1024)
# bind('unix:///var/run/puma.sock?backlog=2048')
#
# @example Set up ssl cert
# bind('ssl://127.0.0.1:9292?key=key.key&cert=cert.pem')
#
# @example Prefer low-latency over higher throughput (via `Socket::TCP_NODELAY`)
# bind('tcp://0.0.0.0:9292?low_latency=true')
#
# @example Set socket permissions
# bind('unix:///var/run/puma.sock?umask=0111')
def bind(url) def bind(url)
@options[:binds] ||= [] @options[:binds] ||= []
@options[:binds] << url @options[:binds] << url