corrected misspelled semaphore variable

This commit is contained in:
Brian Smith 2012-10-09 01:03:49 -04:00
parent 007b1e67d2
commit ed87614309
1 changed files with 10 additions and 6 deletions

View File

@ -83,27 +83,29 @@ module JamWebsockets
begin
routing_key = headers.envelope.routing_key
user_id = routing_key["user.".length..-1]
@sempahore.synchronize do
@log.debug "USER ID = #{user_id}"
@semaphore.synchronize do
contexts = @user_context_lookup[user_id]
@log.debug "CONTEXT = #{contexts}"
unless contexts.nil?
if !contexts.nil?
@log.debug "received user-directed message for user: #{user_id}"
msg = Jampb::ClientMessage.parse(msg)
contexts.each do |context|
EM.schedule do
@log.debug "sending user message to #{context}"
send_to_client(context.client, msg)
end
end
else
@log.debug "Context is null"
end
end
rescue => e
@log.error "unhandled error in messaging to client"
@log.error e
end
end
@ -158,6 +160,7 @@ module JamWebsockets
end
rescue => e
@log.error "EXCEPTION = #{e}"
@log.error "unhandled error in messaging to client"
end
end
@ -496,7 +499,7 @@ module JamWebsockets
# create the friend_update message
friend_update_msg = @message_factory.friend_update(user.id, online)
# send the friend_update to each friend that has active connections
user.friends.each do |friend|
@log.debug "sending friend update message to #{friend}"
@ -617,6 +620,7 @@ module JamWebsockets
session = access_music_session?(session_id, context.user)
@log.debug "publishing to session #{session} from client_id #{client.client_id}"
# put it on the topic exchange for sessions
@sessions_exchange.publish(client_msg.to_s, :routing_key => "session.#{session_id}", :properties => { :headers => { "client_id" => client.client_id } } )
end