Skip to content

Commit

Permalink
Updated presence_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
auser committed May 20, 2009
1 parent b549abe commit c83f7ff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
11 changes: 6 additions & 5 deletions bin/troph-server
Expand Up @@ -18,13 +18,14 @@ EOS

run do |command|
puts "Starting a server at #{command[:host]}"
server = if file = ::File.expand_path(command[:file])
if file = ::File.expand_path(command[:file])
raise StandardError.new("Cannot find file: #{file}") unless ::File.file?(file)
data = open(file).read
eval data
server = eval data
server.run
else
raise StandardError.new("You must pass a file with the -f flag")
end

server.run


end
end
2 changes: 1 addition & 1 deletion lib/troph/messaging/handlers/presence_handler.rb
Expand Up @@ -7,7 +7,7 @@ def handle_message msg
case msg
when Troph::MESSAGES[:heartbeat]
# Do stuff here
puts "Still responding. Send a ping back"
puts "Still responding. Send a ping back"
else
puts "Received presence message: #{msg}"
end
Expand Down
11 changes: 6 additions & 5 deletions lib/troph/p2p/types.rb
@@ -1,12 +1,13 @@
module Troph
MESSAGES = {
:join => "join",
:heartbeat => "alive?"
:join => "m1",
:heartbeat => "m2",
:nominations => "m3"
}

QUEUES = {
:presence => "presence",
:heartbeat => "ping",
:nodes => "nodes"
:presence => "q1",
:heartbeat => "q2",
:nodes => "q3"
}
end

0 comments on commit c83f7ff

Please sign in to comment.