Skip to content

Commit

Permalink
Operating engine handles engine syncs now
Browse files Browse the repository at this point in the history
  • Loading branch information
ccotter committed Oct 16, 2012
1 parent 0b80084 commit bbf026d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion servers/python/coweb/OEHandler.py
Expand Up @@ -101,7 +101,7 @@ def engineSyncInbound(self, data):
site = data.get("siteId", -1)

# ignore our own engine syncs
if site == self.engine.getSiteId():
if site == self.engine.siteId:
return

# give the engine the data
Expand Down
18 changes: 15 additions & 3 deletions servers/python/coweb/session/collab.py
Expand Up @@ -38,6 +38,11 @@ def __init__(self, config, *args, **kwargs):

# Moderator? TODO
self._moderator = session_moderator.get_instance(self.config['sessionModerator'], self.key)
if self._moderator is None:
config['moderatorIsUpdater'] = False
log.warning("Failed to create instance of " + str(self.config['sessionModerator']) +
". Reverting to default session moderator.")
log.warning("Moderator can no longer be updated.")

if self.config['moderatorIsUpdater']:
self._late_join_handler = moderator_late_join_handler(self._moderator, self)
Expand Down Expand Up @@ -101,12 +106,19 @@ def on_publish(self, cl, req, res):
# last state no longer valid
self._manager._late_join_handler.clear_last_state()
if '/app' == matches.group(2):
# put total order sequence number on message
# App sync.
# Put total order sequence number on message
req['data']['order'] = self._manager.get_order()
# let manager deal with the sync if forwarding it to services
self._manager.sync_for_service(cl, req)
# Push sync to op engine.
self._manager._opengine.syncInbound(req['data'])
if self._manager._opengine:
# Push sync to op engine.
self._manager._opengine.syncInbound(req['data'])
elif '/engine' == matches.group(2):
# Engine sync.
if self._manager._opengine:
print "did sync inbound"
self._manager._opengine.engineSyncInbound(req['data'])
# delegate all other handling to base class
super(CollabSessionConnection, self).on_publish(cl, req, res)

Expand Down
1 change: 1 addition & 0 deletions servers/python/coweb/session/session.py
Expand Up @@ -204,3 +204,4 @@ def on_publish(self, cl, req, res):
res['successful'] = False
return
super(SessionConnection, self).on_publish(cl, req, res)

0 comments on commit bbf026d

Please sign in to comment.