Class: RProxy::TargetConnection

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/r_proxy/target_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, disable_cb, buffer_size, usage_manager) ⇒ TargetConnection

Returns a new instance of TargetConnection.



4
5
6
7
8
9
# File 'lib/r_proxy/target_connection.rb', line 4

def initialize(client, disable_cb, buffer_size, usage_manager)
  @disable_unbind_callback = disable_cb
  @client_connection = client
  @buffer_size = buffer_size
  @usage_manager = usage_manager
end

Instance Method Details

#assign_logger(logger) ⇒ Object



11
12
13
# File 'lib/r_proxy/target_connection.rb', line 11

def assign_logger(logger)
  @logger = logger
end

#assign_user_and_password(username, password) ⇒ Object



15
16
17
18
# File 'lib/r_proxy/target_connection.rb', line 15

def assign_user_and_password(username, password)
  @username = username
  @password = password
end

#connection_completedObject



20
21
22
# File 'lib/r_proxy/target_connection.rb', line 20

def connection_completed
  response_proxy_connect_ready
end

#proxy_target_unboundObject



24
25
26
# File 'lib/r_proxy/target_connection.rb', line 24

def proxy_target_unbound
  close_connection
end

#unbindObject



28
29
30
31
# File 'lib/r_proxy/target_connection.rb', line 28

def unbind
  return if @disable_unbind_callback
  @usage_manager.report_usage(@username, @password, get_proxied_bytes)
end