Sha256: fbcbe48965e3d5b381d44d24d08ce49744b4908f5333b353a9009a24ff161e88

Contents?: true

Size: 1.22 KB

Versions: 16

Compression:

Stored size: 1.22 KB

Contents

require Options.paths.root + 'ui/cli/output'
require Options.paths.lib  + 'rpc/server/dispatcher'
require Options.paths.lib  + 'processes/manager'

class Node < Arachni::RPC::Server::Dispatcher::Node

    def initialize
        super Options

        methods.each do |m|
            next if method( m ).owner != Arachni::RPC::Server::Dispatcher::Node
            self.class.send :private, m
            self.class.send :public, m
        end

        @server = Arachni::RPC::Server::Base.new( @options )
        @server.add_async_check do |method|
            # methods that expect a block are async
            method.parameters.flatten.include?( :block )
        end
        @server.add_handler( 'node', self )
        @server.start
    end

    def url
        "#{@options.rpc.server_address}:#{@options.rpc.server_port}"
    end

    def shutdown
        Reactor.global.delay 1 do
            Arachni::Processes::Manager.kill Process.pid
        end
    end

    def connect_to_peer( url )
        self.class.connect_to_peer( url, @options )
    end

    def self.connect_to_peer( url, opts )
        c = Arachni::RPC::Client::Base.new( opts, url )
        Arachni::RPC::Proxy.new( c, 'node' )
    end
end

Reactor.global.run do
    Node.new
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
arachni-1.5.1 spec/support/fixtures/executables/node.rb
arachni-1.5 spec/support/fixtures/executables/node.rb
arachni-1.4 spec/support/fixtures/executables/node.rb
arachni-1.3.2 spec/support/fixtures/executables/node.rb
arachni-1.3.1 spec/support/fixtures/executables/node.rb
arachni-1.3 spec/support/fixtures/executables/node.rb
arachni-1.2.1 spec/support/fixtures/executables/node.rb
arachni-1.2 spec/support/fixtures/executables/node.rb
arachni-1.1 spec/support/fixtures/executables/node.rb
arachni-1.0.6 spec/support/fixtures/executables/node.rb
arachni-1.0.5 spec/support/fixtures/executables/node.rb
arachni-1.0.4 spec/support/fixtures/executables/node.rb
arachni-1.0.3 spec/support/fixtures/executables/node.rb
arachni-1.0.2 spec/support/fixtures/executables/node.rb
arachni-1.0.1 spec/support/fixtures/executables/node.rb
arachni-1.0 spec/support/fixtures/executables/node.rb