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

Federation min depth fix #74

Merged
merged 2 commits into from
Feb 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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