Skip to content

Commit

Permalink
Server#closed_socket? - parameter may be a MiniSSL::Socket (#2596)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSP-Greg committed Apr 18, 2021
1 parent 7ca15c1 commit 28a4cb2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/puma/server.rb
Expand Up @@ -169,11 +169,11 @@ def uncork_socket(socket)
UNPACK_TCP_STATE_FROM_TCP_INFO = "C".freeze

def closed_socket?(socket)
return false unless socket.kind_of? TCPSocket
return false unless @precheck_closing
skt = socket.to_io
return false unless skt.kind_of?(TCPSocket) && @precheck_closing

begin
tcp_info = socket.getsockopt(Socket::IPPROTO_TCP, Socket::TCP_INFO)
tcp_info = skt.getsockopt(Socket::IPPROTO_TCP, Socket::TCP_INFO)
rescue IOError, SystemCallError
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
@precheck_closing = false
Expand Down

0 comments on commit 28a4cb2

Please sign in to comment.