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

split TCP_CORK and TCP_INFO (#2372)

Co-authored-by: pavel <pavel.rosicky@easy.cz>
This commit is contained in:
Pavel Rosický 2020-09-22 17:27:38 +02:00 committed by GitHub
parent 7d00e1dc3c
commit 7928173d70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -101,10 +101,18 @@ module Puma
def tcp_cork_supported?
RbConfig::CONFIG['host_os'] =~ /linux/ &&
Socket.const_defined?(:IPPROTO_TCP) &&
Socket.const_defined?(:TCP_CORK) &&
Socket.const_defined?(:TCP_CORK)
end
# :nodoc:
# @version 5.0.0
def closed_socket_supported?
RbConfig::CONFIG['host_os'] =~ /linux/ &&
Socket.const_defined?(:IPPROTO_TCP) &&
Socket.const_defined?(:TCP_INFO)
end
private :tcp_cork_supported?
private :closed_socket_supported?
end
# On Linux, use TCP_CORK to better control how the TCP stack
@ -131,7 +139,15 @@ module Puma
Thread.current.purge_interrupt_queue if Thread.current.respond_to? :purge_interrupt_queue
end
end
else
def cork_socket(socket)
end
def uncork_socket(socket)
end
end
if closed_socket_supported?
def closed_socket?(socket)
return false unless socket.kind_of? TCPSocket
return false unless @precheck_closing
@ -149,12 +165,6 @@ module Puma
end
end
else
def cork_socket(socket)
end
def uncork_socket(socket)
end
def closed_socket?(socket)
false
end