lib/griffin/engine/single.rb in griffin-0.2.0 vs lib/griffin/engine/single.rb in griffin-0.2.1

- old
+ new

@@ -1,9 +1,8 @@ # frozen_string_literal: true require 'griffin/server' -require 'griffin/listener' module Griffin module Engine class Single def self.create(config) @@ -18,21 +17,23 @@ end def initialize(server, config) @server = server @config = config - @listener = Griffin::Listener.new(@config[:bind], @config[:port]) + @sock = TCPServer.new(@config[:bind], @config[:port]) + @sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) end def run @config[:services].each do |s| @server.handle(s) end install_handler @server.before_run - @server.run(@listener.listen) + @sock.listen(Socket::SOMAXCONN) + @server.run(@sock) end def install_handler trap('INT') do @server.shutdown