diff options
author | Eric Wong <e@80x24.org> | 2013-10-30 20:37:30 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-31 05:04:34 +0000 |
commit | d58bbc251d5b91ede5af220f17bc0359789370d3 (patch) | |
tree | 1e18d3a5f9e8d227f3b9edfe7edf1882015483aa /lib/yahns/server.rb | |
parent | bcac99b8cdcd0f32c4720d822d3049e3426f6cd3 (diff) | |
download | yahns-d58bbc251d5b91ede5af220f17bc0359789370d3.tar.gz |
Users of other web servers may be surprised there is no recommended way to have a new instance of yahns inherit from another web server.
Diffstat (limited to 'lib/yahns/server.rb')
-rw-r--r-- | lib/yahns/server.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb index 220381b..92adf52 100644 --- a/lib/yahns/server.rb +++ b/lib/yahns/server.rb @@ -300,6 +300,15 @@ class Yahns::Server # :nodoc: def inherit_listeners! # inherit sockets from parents, they need to be plain Socket objects # before they become Yahns::UNIXServer or Yahns::TCPServer + # + # Note: we intentionally use a yahns-specific environment variable + # here because existing servers may use non-blocking listen sockets. + # yahns uses _blocking_ listen sockets exclusively. We cannot + # change an existing socket to blocking mode if two servers are + # running (one expecting blocking, one expecting non-blocking) + # because that can completely break the non-blocking one. + # Unfortunately, there is no one-off MSG_DONTWAIT-like flag for + # accept4(2). inherited = ENV['YAHNS_FD'].to_s.split(/,/).map do |fd| io = Socket.for_fd(fd.to_i) set_server_sockopt(io, sock_opts(io)) |