Sha256: ac858dd204d2cadbbf01874fe3d07dd2bdcd8a7e6cf2793fc2e297cdcdcd7a01

Contents?: true

Size: 483 Bytes

Versions: 2

Compression:

Stored size: 483 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
      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

2 entries across 2 versions & 1 rubygems

Version Path
fizx-proxymachine-1.5.3 lib/proxymachine/callback_server_connection.rb
fizx-proxymachine-1.5.2 lib/proxymachine/callback_server_connection.rb