Method: NoSE::Proxy::MysqlProxy#handle_connection

Defined in:
lib/nose/proxy/mysql.rb

#handle_connection(socket) ⇒ Object

Authenticate the client and process queries



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nose/proxy/mysql.rb', line 17

def handle_connection(socket)
  return authenticate socket if @state[socket].nil?

  # Retrieve the saved state of the socket
  protocol = @state[socket]

  begin
    protocol.process_command(&method(:process_query))
  rescue ::Mysql::ClientError::ServerGoneError
    # Ensure the socket is closed and remove the state
    remove_connection socket
    return false
  end

  # Keep this socket around
  true
end