Class: RemoteSyslogSender::TcpSender
- Defined in:
- lib/remote_syslog_sender/tcp_sender.rb
Defined Under Namespace
Classes: NonBlockingTimeout
Instance Attribute Summary
Attributes inherited from Sender
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(remote_hostname, remote_port, options = {}) ⇒ TcpSender
constructor
A new instance of TcpSender.
Methods inherited from Sender
Constructor Details
#initialize(remote_hostname, remote_port, options = {}) ⇒ TcpSender
Returns a new instance of TcpSender.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/remote_syslog_sender/tcp_sender.rb', line 9 def initialize(remote_hostname, remote_port, = {}) super @tls = [:tls] @retry_limit = [:retry_limit] || 3 @retry_interval = [:retry_interval] || 0.5 @remote_hostname = remote_hostname @remote_port = remote_port @ssl_method = [:ssl_method] || 'TLSv1_2' @ca_file = [:ca_file] @verify_mode = [:verify_mode] @timeout = [:timeout] || 600 @timeout_exception = !![:timeout_exception] @exponential_backoff = !![:exponential_backoff] @mutex = Mutex.new @tcp_socket = nil if [:SOL_SOCKET, :SO_KEEPALIVE, :IPPROTO_TCP, :TCP_KEEPIDLE].all? {|c| Socket.const_defined? c} @keep_alive = [:keep_alive] end if Socket.const_defined?(:TCP_KEEPIDLE) @keep_alive_idle = [:keep_alive_idle] end if Socket.const_defined?(:TCP_KEEPCNT) @keep_alive_cnt = [:keep_alive_cnt] end if Socket.const_defined?(:TCP_KEEPINTVL) @keep_alive_intvl = [:keep_alive_intvl] end connect end |
Instance Method Details
#close ⇒ Object
41 42 43 44 |
# File 'lib/remote_syslog_sender/tcp_sender.rb', line 41 def close @socket.close if @socket @tcp_socket.close if @tcp_socket end |