Method: Arachni::Processes::Dispatchers#connect

Defined in:
lib/arachni/processes/dispatchers.rb

#connect(url, options = { }) ⇒ RPC::Client::Dispatcher

Connects to a Dispatcher by URL.

Parameters:

  • url (String)

    URL of the Dispatcher.

  • options (Hash) (defaults to: { })

    Options for the RPC client.

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/arachni/processes/dispatchers.rb', line 35

def connect( url, options = { } )
    Reactor.global.run_in_thread if !Reactor.global.running?

    options[:client_max_retries] = options.delete(:max_retries)

    fresh = options.delete( :fresh )

    opts     = OpenStruct.new
    opts.rpc = OpenStruct.new( options )

    if fresh
        @dispatcher_connections[url] = RPC::Client::Dispatcher.new( opts, url )
    else
        @dispatcher_connections[url] ||= RPC::Client::Dispatcher.new( opts, url )
    end
end