Skip to content

Commit

Permalink
Merged Engine#start into #run.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed May 28, 2024
1 parent 47a8203 commit 7bc937e
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions lib/ronin/recon/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,21 @@ def self.run(values,**kwargs,&block)
# start the engine in it's own Async task
Async do |task|
# start the engine
engine.start(task)
engine.run(task)
end

return engine
end

#
# Starts the recon engine.
# The main recon engine event loop.
#
# @param [Async::Task] task
# The async task to run the recon engine under.
# The parent async task.
#
# @api private
#
def start(task=Async::Task.current)
def run(task=Async::Task.current)
# enqueue the scope values for processing
# rubocop:disable Style/HashEachMethods
@scope.values.each do |value|
Expand All @@ -177,7 +177,13 @@ def start(task=Async::Task.current)
# rubocop:enable Style/HashEachMethods

# output consumer task
task.async { run }
task.async do
until (@value_status.empty? && @output_queue.empty?)
process(@output_queue.dequeue)
end

shutdown!
end

# start all work groups
@worker_tasks.each_value do |worker_tasks|
Expand All @@ -187,19 +193,6 @@ def start(task=Async::Task.current)
end
end

#
# The main recon engine event loop.
#
# @api private
#
def run
until (@value_status.empty? && @output_queue.empty?)
process(@output_queue.dequeue)
end

shutdown!
end

#
# Adds a worker class to the engine.
#
Expand Down

0 comments on commit 7bc937e

Please sign in to comment.