diff options
Diffstat (limited to 'lib/yahns/server.rb')
-rw-r--r-- | lib/yahns/server.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/yahns/server.rb b/lib/yahns/server.rb index 1196d2d..e05a0e4 100644 --- a/lib/yahns/server.rb +++ b/lib/yahns/server.rb @@ -177,10 +177,9 @@ class Yahns::Server # :nodoc: tries = 5 begin - io = bind_listen(address, sock_opts(address)) - unless Yahns::TCPServer === io || Yahns::UNIXServer === io - io = server_cast(io) - end + opts = sock_opts(address) + io = bind_listen(address, opts) + io = server_cast(io, opts) unless io.class.name.start_with?('Yahns::') @logger.info "listening on addr=#{sock_name(io)} fd=#{io.fileno}" @listeners << io io @@ -298,7 +297,7 @@ class Yahns::Server # :nodoc: end def sock_opts(io) - @config.config_listeners[sock_name(io)] + @config.config_listeners[sock_name(io)] || {} end def inherit_listeners! @@ -315,9 +314,10 @@ class Yahns::Server # :nodoc: # 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)) + opts = sock_opts(io) + set_server_sockopt(io, opts) @logger.info "inherited addr=#{sock_name(io)} fd=#{fd}" - server_cast(io) + server_cast(io, opts) end @listeners.replace(inherited) @@ -368,6 +368,7 @@ class Yahns::Server # :nodoc: ctx.queue = queues[qegg] ||= qegg_vivify(qegg, fdmap) ctx = ctx.dup ctx.__send__(:include, l.expire_mod) + ctx.__send__(:include, Yahns::OpenSSLClient) if opts[:ssl_ctx] ctx_list << ctx # acceptors feed the the queues l.spawn_acceptor(opts[:threads] || 1, @logger, ctx) |