Class: RemoteSyslogLogger::TcpSender

Inherits:
Sender
  • Object
show all
Defined in:
lib/remote_syslog_logger/tcp_sender.rb

Instance Method Summary collapse

Methods inherited from Sender

#close, #transmit

Constructor Details

#initialize(remote_hostname, remote_port, options = {}) ⇒ TcpSender

Returns a new instance of TcpSender.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/remote_syslog_logger/tcp_sender.rb', line 7

def initialize(remote_hostname, remote_port, options = {})
  super
  @tls             = options[:tls]
  @retry_limit     = options[:retry_limit] || 3
  @remote_hostname = remote_hostname
  @remote_port     = remote_port
  @ssl_method      = options[:ssl_method] || 'TLSv1_2'
  @ca_file         = options[:ca_file]
  @verify_mode     = options[:verify_mode]
  if [:SOL_SOCKET, :SO_KEEPALIVE, :IPPROTO_TCP, :TCP_KEEPIDLE].all? {|c| Socket.const_defined? c}
    @keep_alive      = options[:keep_alive]
  end
  if Socket.const_defined?(:TCP_KEEPIDLE)
    @keep_alive_idle = options[:keep_alive_idle]
  end
  if Socket.const_defined?(:TCP_KEEPCNT)
    @keep_alive_cnt  = options[:keep_alive_cnt]
  end
  if Socket.const_defined?(:TCP_KEEPINTVL)
    @keep_alive_intvl = options[:keep_alive_intvl]
  end
  connect
end