Sha256: ddb7c1686bc9feed4f54776eb48a2ca6f29c29ed30cb5a7775303c3946666ad6

Contents?: true

Size: 511 Bytes

Versions: 3

Compression:

Stored size: 511 Bytes

Contents

class ProxyMachine
  class CallbackServerConnection < ServerConnection
    
    def post_init
      # empty
    end
    
    def callback=(c)
      @callback = c
    end
    
    def receive_data(data)
      @buffer ||= []
      @buffer << data
      @data_received = true
      if returned = @callback.call(@buffer.join(''))
        @client_side.send_data returned
        proxy_incoming_to(@client_side, 10240)
      end
    rescue => e
      $logger.info e.message + e.backtrace.join("\n")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fizx-proxymachine-1.6.1 lib/proxymachine/callback_server_connection.rb
fizx-proxymachine-1.6.0 lib/proxymachine/callback_server_connection.rb
fizx-proxymachine-1.5.4 lib/proxymachine/callback_server_connection.rb