mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fix Binder @unix_paths handling
1. Move removal to launcher from single and cluster. 2. @unix_paths only contains files that Puma creates (pre-existing files are not)
This commit is contained in:
parent
3adff9e21d
commit
1a484d8d1c
4 changed files with 5 additions and 9 deletions
|
@ -361,7 +361,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=1024)
|
def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
|
||||||
@unix_paths << path
|
@unix_paths << path unless File.exist? path
|
||||||
|
|
||||||
# Let anyone connect by default
|
# Let anyone connect by default
|
||||||
umask ||= 0
|
umask ||= 0
|
||||||
|
@ -399,7 +399,7 @@ module Puma
|
||||||
end
|
end
|
||||||
|
|
||||||
def inherit_unix_listener(path, fd)
|
def inherit_unix_listener(path, fd)
|
||||||
@unix_paths << path
|
@unix_paths << path unless File.exist? path
|
||||||
|
|
||||||
if fd.kind_of? TCPServer
|
if fd.kind_of? TCPServer
|
||||||
s = fd
|
s = fd
|
||||||
|
@ -420,7 +420,8 @@ module Puma
|
||||||
io.close
|
io.close
|
||||||
uri = URI.parse(l)
|
uri = URI.parse(l)
|
||||||
next unless uri.scheme == 'unix'
|
next unless uri.scheme == 'unix'
|
||||||
File.unlink("#{uri.host}#{uri.path}")
|
unix_path = "#{uri.host}#{uri.path}"
|
||||||
|
File.unlink unix_path if @unix_paths.include? unix_path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,6 @@ module Puma
|
||||||
@suicide_pipe.close
|
@suicide_pipe.close
|
||||||
read.close
|
read.close
|
||||||
@wakeup.close
|
@wakeup.close
|
||||||
@launcher.close_binder_unix_paths
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,7 @@ module Puma
|
||||||
when :exit
|
when :exit
|
||||||
# nothing
|
# nothing
|
||||||
end
|
end
|
||||||
|
@binder.close_unix_paths
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return which tcp port the launcher is using, if it's using TCP
|
# Return which tcp port the launcher is using, if it's using TCP
|
||||||
|
@ -204,10 +205,6 @@ module Puma
|
||||||
@binder.close_listeners
|
@binder.close_listeners
|
||||||
end
|
end
|
||||||
|
|
||||||
def close_binder_unix_paths
|
|
||||||
@binder.close_unix_paths
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# If configured, write the pid of the current process out
|
# If configured, write the pid of the current process out
|
||||||
|
|
|
@ -118,7 +118,6 @@ module Puma
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
# Swallow it
|
# Swallow it
|
||||||
end
|
end
|
||||||
@launcher.close_binder_unix_paths
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue