1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Close the binder in the right place. Fixes #192

This commit is contained in:
Evan Phoenix 2013-02-09 10:12:13 -08:00
parent b10b25fb9b
commit 2e24400246
2 changed files with 9 additions and 2 deletions

View file

@ -526,7 +526,7 @@ module Puma
server = Puma::Server.new @config.app, @events
server.min_threads = min_t
server.max_threads = max_t
server.binder = @binder
server.inherit_binder @binder
Signal.trap "SIGTERM" do
server.stop

View file

@ -64,6 +64,8 @@ module Puma
@persistent_timeout = PERSISTENT_TIMEOUT
@binder = Binder.new(events)
@own_binder = true
@first_data_timeout = FIRST_DATA_TIMEOUT
ENV['RACK_ENV'] ||= "development"
@ -75,6 +77,11 @@ module Puma
forward :add_ssl_listener, :@binder
forward :add_unix_listener, :@binder
def inherit_binder(bind)
@binder = bind
@own_binder = false
end
# On Linux, use TCP_CORK to better control how the TCP stack
# packetizes our stream. This improves both latency and throughput.
#
@ -194,7 +201,7 @@ module Puma
@check.close
@notify.close
unless @status == :restart
if @status != :restart and @own_binder
@binder.close
end
end