Module: Dalli::Server::TCPSocketOptions

Defined in:
lib/dalli/socket.rb

Instance Method Summary collapse

Instance Method Details

#setsockopts(sock, options) ⇒ Object


5
6
7
8
9
10
# File 'lib/dalli/socket.rb', line 5

def setsockopts(sock, options)
  sock.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, true)
  sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true) if options[:keepalive]
  sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF, options[:rcvbuf]) if options[:rcvbuf]
  sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_SNDBUF, options[:sndbuf]) if options[:sndbuf]
end