Project

General

Profile

« Previous | Next » 

Revision 475571dd

Added by Marc Dequènes almost 14 years ago

  • ID 475571dd6ad8a8c0f74c8b05c2915a7b9bf1495f

[fix] Conversation: handle timer better when closing

View differences:

lib/cyborghood/cyborg/botnet/conversation.rb
@conv_threads_closing << name
stop_idle_thread_check(@conv_threads[name])
@conv_threads[name].close
# if only the system thread remains, notify idleness
......
logger.debug "Thread '#{conv_thread.name}@#{@peer_name}' is working, canceling idle check"
# cancel time if exists
stop_idle_thread_check(conv_thread)
end
def stop_idle_thread_check(conv_thread)
timer = @conv_threads_timers[conv_thread.id]
EventMachine.cancel_timer(timer) unless timer.nil?
@conv_threads_timers[conv_thread.id] = nil
......
# but any communication through the thread (errors, protocol stuff, ...)
# that's why it is checked here and not in the ConversationThread class
def check_idle_thread(conv_thread)
return if @comm_stop
return if @auto_close_threads.nil?
return if @conv_threads_closing.include? conv_thread.name

Also available in: Unified diff