Revision 8c18bc9a
Added by Marc Dequènes over 13 years ago
- ID 8c18bc9aff8959ed4d8687094cf72b9b02f9bbd7
lib/cyborghood/cyborg/protocol.rb | ||
---|---|---|
VERSION = "0.1"
|
||
CAPABILITIES = []
|
||
|
||
attr_reader :system_notification
|
||
|
||
@@request_callback = proc do |result|
|
||
protocol = result[:reply_message].conv_thread.conversation.protocol
|
||
protocol.process_request_result(result)
|
||
end
|
||
|
||
# TODO:
|
||
# - check for request/reply couples (reply to wrong of non-existent request)
|
||
|
||
def initialize(conversation)
|
||
@conversation = conversation
|
||
|
||
... | ... | |
@negociation_ok = false
|
||
|
||
@action_followup = {}
|
||
|
||
@system_notification = EventMachine::Channel.new
|
||
end
|
||
|
||
def negociation_ok?
|
||
... | ... | |
method = "receive_" + message.action_code.downcase.tr(" ", "_")
|
||
if respond_to? method
|
||
send(method, message)
|
||
check_thread_idle(message.conv_thread)
|
||
else
|
||
send_error_protocol "unknown action"
|
||
end
|
||
... | ... | |
|
||
cb
|
||
end
|
||
|
||
def check_thread_idle(conv_thread)
|
||
return if @action_followup.has_key? conv_thread.id
|
||
|
||
@system_notification << { :topic => 'THREAD IDLE', :thread => conv_thread.name }
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] internal notification when thread is idle allowed to mark thread closing pending