Skip to content

Missing TCP_INFO support #6399

@headius

Description

@headius

In #6366 we added support for the TCP_CORK flag on Linux. This flag is used by Puma to "cork" packets and work around the "delayed ack" problem.

However the logic in Puma also depends on TCP_INFO, which we still do not support. In puma/puma#2349, @ahorek modified Puma to only use the TCP_CORK logic when TCP_CORK is present, but it also checks for the presence of TCP_INFO. This means it will still not be used on JRuby.

Unfortunately the logic for TCP_INFO is much more than just defining the constant. See the related code from CRuby 2.6.5:

https://github.com/ruby/ruby/blob/97e05dad7ffca0d2fd496fb8e33ddcd7def6748b/ext/socket/option.c#L813-L1138

I believe we would need to do at least the following:

  • Add constants for "TCPI".
  • Duplicate the struct layout using JNR. This may be a good time for us to consider something like a jnr-socket that would supersede jnr-unixsocket but also handle socket options and other socket types. This would be a bridge to supporting FFI-based sockets as in Support the FFI-based rubysl-socket implementation #6334.
  • Duplicate the destructuring macros from CRuby.
  • Add appropriate constants and logic to JRuby.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions