Sha256: b056a03842c6b93bdaa3c16e2127272f7486c95239e615d110ac9335ca761ca1

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 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(''))
        proxy_incoming_to(@client_side, 10240)
        @client_side.send_data returned
      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

1 entries across 1 versions & 1 rubygems

Version Path
fizx-proxymachine-1.2.0 lib/proxymachine/callback_server_connection.rb