Project

General

Profile

« Previous | Next » 

Revision a089227c

Added by Marc Dequènes about 13 years ago

  • ID a089227ca94121115f46e5998b497fa102787398

[fix/evol] work on better Interface/Task/Conversation/… sync and bot stop action in order to avoid races and locks

View differences:

lib/cyborghood/cyborg/botnet.rb
def contact_peer(peer, block, dont_open_new_connection = false)
if @comm_list.has_key? peer
logger.debug "Botnet: Reusing connection for peer #{peer}"
return block.call @comm_list[peer]
if @comm_list[peer].usuable?
logger.debug "Botnet: Reusing connection for peer #{peer}"
return block.call @comm_list[peer]
end
end
return if dont_open_new_connection
......
# used to quit properly and later to reuse communication channels
def register_communication(peer, conversation)
logger.debug "Botnet: conversation with '#{peer}' ready"
@comm_list[peer] = conversation
end
def unregister_communication(peer)
logger.debug "Botnet: conversation with '#{peer}' closed"
@comm_list.delete(peer)
@pending_conversation_close.delete(peer)
end
def ask_to_stop
@comm_list.values.each {|conv| conv.bye }
super
def stop(condition)
super do
@comm_list.each_value{|conv| conv.stop(condition) }
end
end
protected

Also available in: Unified diff