Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #74 from matrix-org/federation_min_depth_fix
Browse files Browse the repository at this point in the history
Federation min depth fix
  • Loading branch information
erikjohnston committed Feb 16, 2015
2 parents a5ad6f8 + 91fc5ee commit bfffd2e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ def _handle_new_pdu(self, origin, pdu, max_recursion=10):
)
if already_seen:
logger.debug("Already seen pdu %s", pdu.event_id)
defer.returnValue({})
return

# Check signature.
Expand Down Expand Up @@ -367,7 +366,13 @@ def _handle_new_pdu(self, origin, pdu, max_recursion=10):
pdu.room_id, min_depth
)

if min_depth and pdu.depth > min_depth and max_recursion > 0:
if min_depth and pdu.depth < min_depth:
# This is so that we don't notify the user about this
# message, to work around the fact that some events will
# reference really really old events we really don't want to
# send to the clients.
pdu.internal_metadata.outlier = True
elif min_depth and pdu.depth > min_depth and max_recursion > 0:
for event_id, hashes in pdu.prev_events:
if event_id not in have_seen:
logger.debug(
Expand Down Expand Up @@ -418,16 +423,14 @@ def _handle_new_pdu(self, origin, pdu, max_recursion=10):
except:
logger.warn("Failed to get state for event: %s", pdu.event_id)

ret = yield self.handler.on_receive_pdu(
yield self.handler.on_receive_pdu(
origin,
pdu,
backfilled=False,
state=state,
auth_chain=auth_chain,
)

defer.returnValue(ret)

def __str__(self):
return "<ReplicationLayer(%s)>" % self.server_name

Expand Down

0 comments on commit bfffd2e

Please sign in to comment.