Class: RubyTls::Connection::DataCallback
- Inherits:
-
FFI::Function
- Object
- FFI::Function
- RubyTls::Connection::DataCallback
- Defined in:
- lib/ruby-tls/connection.rb
Class Method Summary collapse
Class Method Details
.new(callbacks) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/ruby-tls/connection.rb', line 110 def self.new(callbacks) super(:void, [::RubyTls::State.ptr, :pointer, :int]) do |state, buffer, length| begin data = buffer.get_bytes(0, length) yield(data) rescue => e # shutdown the connection on error # TODO:: Provide some debugging output callbacks[:close_cb].call state end end end |