From 15b079439222e489915380021b9dca7b9fa5ff65 Mon Sep 17 00:00:00 2001 From: Patrik Ragnarsson Date: Fri, 2 Apr 2021 02:20:39 +0200 Subject: [PATCH] Define UNPACK_TCP_STATE_FROM_TCP_INFO in the right place (#2588) This fixes the issue for me when I run Puma in FreeBSD using Vagrant. Close https://github.com/puma/puma/issues/2556 --- lib/puma/server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puma/server.rb b/lib/puma/server.rb index 0b42460c..d0e09a34 100644 --- a/lib/puma/server.rb +++ b/lib/puma/server.rb @@ -137,8 +137,6 @@ module Puma # socket parameter may be an MiniSSL::Socket, so use to_io # if tcp_cork_supported? - UNPACK_TCP_STATE_FROM_TCP_INFO = "C".freeze - # 6 == Socket::IPPROTO_TCP # 3 == TCP_CORK # 1/0 == turn on/off @@ -168,6 +166,8 @@ module Puma end if closed_socket_supported? + UNPACK_TCP_STATE_FROM_TCP_INFO = "C".freeze + def closed_socket?(socket) return false unless socket.kind_of? TCPSocket return false unless @precheck_closing