Revision 429ebb9c
Added by Marc Dequènes over 13 years ago
- ID 429ebb9c1a44108e2da28316170ad4345617a58d
lib/cyborghood/cyborg/botnet/dsl.rb | ||
---|---|---|
if conv
|
||
logger.debug "Task '#{@name}': Peer '#{peer}' contacted, starting conversation"
|
||
|
||
@peer_contacted << peer
|
||
|
||
# don't use the block call to leave the conversation thread open
|
||
conv_thread = conv.thread(@notification_name)
|
||
conv_thread.call(cmd, *args) do |reply|
|
||
... | ... | |
end
|
||
end
|
||
end
|
||
end
|
||
|
||
Task.class_eval do
|
||
include BotnetTask
|
||
def _setup
|
||
super
|
||
|
||
@peer_contacted = Set.new
|
||
end
|
||
|
||
def _finished
|
||
super
|
||
|
||
cb = Proc.new do |conv|
|
||
conv.close_thread(@notification_name)
|
||
end
|
||
|
||
@peer_contacted.each do |peer|
|
||
@bot.contact_peer(peer, true, &cb)
|
||
end
|
||
end
|
||
end
|
||
|
||
Task.class_eval("include BotnetTask")
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] BotnetTask DSL: now that we have one Task per task, close conversation thread as soon as the task is finished