Class: Rack::SocketDuplex
- Inherits:
-
Object
- Object
- Rack::SocketDuplex
- Defined in:
- lib/socket_duplex.rb
Constant Summary collapse
- MAX_QUEUE_SIZE =
50- NUM_OF_THREADS =
5- @@queue =
Utils::QueueWithTimeout.new
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, socket_path, secful_key, verify_mode = OpenSSL::SSL::VERIFY_PEER) ⇒ SocketDuplex
constructor
A new instance of SocketDuplex.
Constructor Details
#initialize(app, socket_path, secful_key, verify_mode = OpenSSL::SSL::VERIFY_PEER) ⇒ SocketDuplex
Returns a new instance of SocketDuplex.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/socket_duplex.rb', line 14 def initialize(app, socket_path, secful_key, verify_mode=OpenSSL::SSL::VERIFY_PEER) @app, @socket_path, @verify_mode = app, socket_path, verify_mode begin puts 'secful: initialize' @secful_key = secful_key puts 'secful: secful_key' @agent_identifier = SecureRandom.hex puts 'secful: agent_identifier' @machine_ip = Socket.ip_address_list.detect(&:ipv4_private?).try(:ip_address) puts 'secful: machine_ip' #@queue = SizedQueue.new(MAX_QUEUE_SIZE) #puts 'secful: queue init ' + @queue.__id__.to_s @threads_to_sockets = {} puts 'secful: threads_to_sockets' Thread.new { activate_workers() } puts 'secful: activate_workers()' rescue Exception => e puts 'secful: init-exception: ' + e. puts 'secful: init-trace: ' + e.backtrace.inspect end end |
Instance Method Details
#call(env) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/socket_duplex.rb', line 36 def call(env) begin puts 'secful: call' dup._call(env) rescue Exception => e puts 'secful: call-exception: ' + e. puts 'secful: call-trace: ' + e.backtrace.inspect @app.call(env) end end |