Skip to content

Commit

Permalink
Define UNPACK_TCP_STATE_FROM_TCP_INFO in the right place (#2588)
Browse files Browse the repository at this point in the history
This fixes the issue for me when I run Puma in FreeBSD using Vagrant.

Close #2556
  • Loading branch information
dentarg committed Apr 2, 2021
1 parent 403975b commit 15b0794
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/puma/server.rb
Expand Up @@ -137,8 +137,6 @@ def closed_socket_supported?
# 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
Expand Down Expand Up @@ -168,6 +166,8 @@ def uncork_socket(socket)
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
Expand Down

0 comments on commit 15b0794

Please sign in to comment.