Skip to content

Commit

Permalink
rref #5367
Browse files Browse the repository at this point in the history
rref #5366
ref #66
ref #65
  • Loading branch information
evrenesat committed Jun 30, 2016
1 parent f13faf9 commit 2e5c623
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zengine/tornado_server/ws_to_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,8 @@ def on_input_queue_declare(self, queue):
def ask_for_user_id(self, sess_id):
log.debug(sess_id)
# TODO: add remote ip
self.publish_incoming_message({'view': 'sessid_to_userid',
'_zops_remote_ip': '',
}, sess_id)
self.publish_incoming_message(dict(_zops_remote_ip='',
data={'view': 'sessid_to_userid'}), sess_id)


def register_websocket(self, sess_id, ws):
Expand All @@ -204,12 +203,12 @@ def register_websocket(self, sess_id, ws):
log.debug("GET SESSUSERS: %s" % sys.sessid_to_userid)
try:
user_id = sys.sessid_to_userid[sess_id]
self.websockets[user_id] = ws
except KeyError:
self.ask_for_user_id(sess_id)
self.websockets[sess_id] = ws
self.websockets[user_id] = ws
user_id = sess_id
self.create_out_channel(sess_id, user_id)
return True

def inform_disconnection(self, sess_id):
self.in_channel.basic_publish(exchange='input_exc',
Expand Down Expand Up @@ -272,6 +271,8 @@ def on_message(self, channel, method, header, body):
reply = json_decode(body)
sys.sessid_to_userid[reply['sess_id']] = reply['user_id']
self.websockets[reply['user_id']] = self.websockets[reply['sess_id']]
del self.websockets[reply['sess_id']]
channel.basic_ack(delivery_tag=method.delivery_tag)

# else:
# channel.basic_reject(delivery_tag=method.delivery_tag)
1 change: 1 addition & 0 deletions zengine/views/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@
def sessid_to_userid(current):
current.output['user_id'] = current.user_id.lower()
current.output['sess_id'] = current.session.sess_id
current.user.bind_private_channel(current.session.sess_id)
current.output['sessid_to_userid'] = True

0 comments on commit 2e5c623

Please sign in to comment.