Class: RubyTls::Connection::Callback

Inherits:
FFI::Function
  • Object
show all
Defined in:
lib/ruby-tls/connection.rb

Class Method Summary collapse

Class Method Details

.new(callbacks) ⇒ Object

Creates a new Parser callback.



96
97
98
99
100
101
102
103
104
105
106
# File 'lib/ruby-tls/connection.rb', line 96

def self.new(callbacks)
    super(:void, [::RubyTls::State.ptr]) do |state|
        begin
            yield
        rescue => e
            # shutdown the connection on error

            # TODO:: Provide some debugging output

            callbacks[:close_cb].call state
        end
    end
end