Sha256: dc560e4cb292cade3a0c324aaa4cc26597c815da0578a1203444d0d82be0f20d

Contents?: true

Size: 422 Bytes

Versions: 4

Compression:

Stored size: 422 Bytes

Contents

class Socket
  def tcp_fast_open
    # macOS devices option is DIFFERENT from Linux and FreeBSD
    opt = (/darwin/ =~ RUBY_PLATFORM) ? 1 : 5
    # Magic number 6 may refer to Socket::SOL_TCP or Socket::IPPROTO_TCP
    setsockopt(6, Socket::TCP_FASTOPEN, opt)
    true
  rescue => _e
    false
  end

  def reuse_port
    setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEPORT, 1)
    true
  rescue => _e
    false
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
midori.rb-0.9.0 lib/midori/core_ext/socket.rb
midori.rb-0.8.0 lib/midori/core_ext/socket.rb
midori.rb-0.7.1 lib/midori/core_ext/socket.rb
midori.rb-0.7.0 lib/midori/core_ext/socket.rb