about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-07-03 08:50:25 +0000
committerEric Wong <e@80x24.org>2015-07-03 10:05:11 +0000
commit602784e227c3d792c492ffd45df81182eb0fa9dc (patch)
tree739e113a8e60d8a91ac2c2f744cadf8ced280d19 /lib
parentd3f28e0fa44318f9af4409fc9b865d5094ccc1ee (diff)
downloadyahns-602784e227c3d792c492ffd45df81182eb0fa9dc.tar.gz
TCP socket options are now set when inheriting existing sockets from
a parent process.  I'm fairly certain all the TCP setsockopt knobs
we use are idempotent and harmless to change.

If anything, the only directive I'd be uncomfortable changing is
shortening the listen(2) (aka :backlog) size, but we've always
changed that anyways since it also applies to UNIX sockets.

Note: removing a configuration knob in a yahns config file can not
reset the value to the OS-provided default setting.  Inherited
sockets must use a new setting to override existing ones.
(or the socket needs to be closed and re-created in the process
 launcher before yahns inherits it).

Based on unicorn commit 1db9a8243d42cc86d5ca4901bceb305061d0d212

Noticed-by: Christos Trochalakis <yatiohi@ideopolis.gr>
  <20150626114129.GA25883@luke.ws.skroutz.gr>
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/server.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb
index 3b9addc..b6663e1 100644
--- a/lib/yahns/server.rb
+++ b/lib/yahns/server.rb
@@ -315,9 +315,10 @@ class Yahns::Server # :nodoc:
     inherited = ENV['YAHNS_FD'].to_s.split(',').map! do |fd|
       io = Socket.for_fd(fd.to_i)
       opts = sock_opts(io)
+      io = server_cast(io, opts)
       set_server_sockopt(io, opts)
       @logger.info "inherited addr=#{sock_name(io)} fd=#{fd}"
-      server_cast(io, opts)
+      io
     end
 
     @listeners.replace(inherited)