Class: Akane::Receivers::Stream::CustomSSLSocketFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/akane/receivers/stream.rb

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ CustomSSLSocketFactory

Returns a new instance of CustomSSLSocketFactory.



137
138
139
# File 'lib/akane/receivers/stream.rb', line 137

def initialize(target)
  @target = target
end

Instance Method Details

#new(*args) ⇒ Object



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/akane/receivers/stream.rb', line 141

def new(*args)
  OpenSSL::SSL::SSLSocket.new(*args).tap do |sock|
    class << sock
      def last_target=(x)
        @akane_ext_last_target = x
      end
      def readpartial(*)
        super.tap do |x|
          @akane_ext_last_target.last = Time.now
        end
      end
    end
    sock.last_target = @target
  end
end