118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# File 'lib/arachni/rpc/server/dispatcher/node.rb', line 118
def neighbours_with_info( &block )
fail 'This method requires a block!' if !block_given?
@neighbours_cmp = ''
if @nodes_info_cache.empty? || @neighbours_cmp != neighbours.to_s
@neighbours_cmp = neighbours.to_s
each = proc do |neighbour, iter|
connect_to_peer( neighbour ).info do |info|
if info.rpc_exception?
print_info "Neighbour seems dead: #{neighbour}"
add_dead_neighbour( neighbour )
log_updated_neighbours
iter.return( nil )
else
iter.return( info )
end
end
end
after = proc do |nodes|
@nodes_info_cache = nodes.compact
block.call( @nodes_info_cache )
end
Reactor.global.create_iterator( neighbours ).map( each, after )
else
block.call( @nodes_info_cache )
end
end
|