Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split TCP_CORK and TCP_INFO [changelog skip] #2372

Merged
merged 1 commit into from Sep 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 17 additions & 7 deletions lib/puma/server.rb
Expand Up @@ -101,10 +101,18 @@ class << self
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
Expand All @@ -131,7 +139,15 @@ def uncork_socket(socket)
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
Expand All @@ -149,12 +165,6 @@ def closed_socket?(socket)
end
end
else
def cork_socket(socket)
end

def uncork_socket(socket)
end

def closed_socket?(socket)
false
end
Expand Down