diff options
author | Matthew <matthew@matrix.org> | 2017-01-07 03:44:11 +0000 |
---|---|---|
committer | Matthew <matthew@matrix.org> | 2017-01-07 03:44:18 +0000 |
commit | 4304e7e5939957764b2cb62f4d90dd6eae8b44fb (patch) | |
tree | 70fed50b018a7de55aaec2bbfba5c60aaa7c2b34 /synapse | |
parent | changelog (diff) | |
download | synapse-4304e7e5939957764b2cb62f4d90dd6eae8b44fb.tar.xz |
do the discard check in the right place to avoid grabbing dependent events
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/federation/federation_server.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index 5f6e6cbb42..1fee4e83a6 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -144,6 +144,26 @@ class FederationServer(FederationBase): results = [] for pdu in pdu_list: + # check that it's actually being sent from a valid destination to + # workaround bug #1753 in 0.18.5 and 0.18.6 + if transaction.origin != get_domain_from_id(pdu.event_id): + if not ( + pdu.type == 'm.room.member' and + pdu.content and + pdu.content.get("membership", None) == 'join' and + self.hs.is_mine_id(pdu.state_key) + ): + logger.info( + "Discarding PDU %s from invalid origin %s", + pdu.event_id, transaction.origin + ) + continue + else: + logger.info( + "Accepting join PDU %s from %s", + pdu.event_id, transaction.origin + ) + try: yield self._handle_new_pdu(transaction.origin, pdu) results.append({}) @@ -477,26 +497,6 @@ class FederationServer(FederationBase): @log_function def _handle_new_pdu(self, origin, pdu, get_missing=True): - # check that it's actually being sent from a valid destination to - # workaround bug #1753 in 0.18.5 and 0.18.6 - if origin != get_domain_from_id(pdu.event_id): - if not ( - pdu.type == 'm.room.member' and - pdu.content and - pdu.content.get("membership", None) == 'join' and - self.hs.is_mine_id(pdu.state_key) - ): - logger.info( - "Discarding PDU %s from invalid origin %s", - pdu.event_id, origin - ) - return - else: - logger.info( - "Accepting join PDU %s from %s", - pdu.event_id, origin - ) - # We reprocess pdus when we have seen them only as outliers existing = yield self._get_persisted_pdu( origin, pdu.event_id, do_auth=False |