Simplify to always drop events if server isn't in the room

This commit is contained in:
Erik Johnston 2018-11-09 11:34:45 +00:00
parent 3cecf5340d
commit 30dd27afff

View File

@ -202,27 +202,22 @@ class FederationHandler(BaseHandler):
self.room_queues[room_id].append((pdu, origin)) self.room_queues[room_id].append((pdu, origin))
return return
# If we're no longer in the room just ditch the event entirely. This # If we're not in the room just ditch the event entirely. This is
# is probably an old server that has come back and thinks we're still # probably an old server that has come back and thinks we're still in
# in the room (or we've been rejoined to the room by a state reset). # the room (or we've been rejoined to the room by a state reset).
# #
# If we were never in the room then maybe our database got vaped and # Note that if we were never in the room then we would have already
# we should check if we *are* in fact in the room. If we are then we # dropped the event, since we wouldn't know the room version.
# can magically rejoin the room.
is_in_room = yield self.auth.check_host_in_room( is_in_room = yield self.auth.check_host_in_room(
room_id, room_id,
self.server_name self.server_name
) )
if not is_in_room: if not is_in_room:
was_in_room = yield self.store.was_host_joined( logger.info(
pdu.room_id, self.server_name, "[%s %s] Ignoring PDU from %s as we're not in the room",
room_id, event_id, origin,
) )
if was_in_room: defer.returnValue(None)
logger.info(
"[%s %s] Ignoring PDU from %s as we've left the room",
room_id, event_id, origin,
)
defer.returnValue(None)
state = None state = None
auth_chain = [] auth_chain = []