From 7e827382d2461aa9fc93f3d09dc262559988d364 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Mon, 2 Sep 2019 02:15:25 -0500 Subject: [PATCH] lib\puma\accept_nonblock.rb - fix socket closing on error (#1941) * lib\puma\accept_nonblock.rb - fix socket closing on error See: https://github.com/ruby/ruby/commit/68ac33a511929268ff5b0e05601b855a3a031b31 * test/test_integration.rb - fix my typo that causes a warning --- lib/puma/accept_nonblock.rb | 6 +++++- test/test_integration.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/puma/accept_nonblock.rb b/lib/puma/accept_nonblock.rb index e697032a2e..08ad997f8b 100644 --- a/lib/puma/accept_nonblock.rb +++ b/lib/puma/accept_nonblock.rb @@ -15,7 +15,11 @@ def accept_nonblock ssl.accept if @start_immediately ssl rescue SSLError => ex - sock.close + if ssl + ssl.close + else + sock.close + end raise ex end end diff --git a/test/test_integration.rb b/test/test_integration.rb index d9d9c49470..33d0a5cfec 100644 --- a/test/test_integration.rb +++ b/test/test_integration.rb @@ -517,5 +517,5 @@ def run_launcher(conf) @wait.sysread 1 [thr, launcher, @events] - end + end end