Sha256: aca6d8f6440b2ac30c9dee5eb0b1ee89762d8638825d3ac87c9d493da81fb20a

Contents?: true

Size: 557 Bytes

Versions: 3

Compression:

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

    def unbind
      @client_side.close_connection_after_writing
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fizx-proxymachine-1.5.1 lib/proxymachine/callback_server_connection.rb
fizx-proxymachine-1.5.0 lib/proxymachine/callback_server_connection.rb
fizx-proxymachine-1.4.0 lib/proxymachine/callback_server_connection.rb