Fix regression where we no longer correctly handled the case of gaps in our event graph

This commit is contained in:
Erik Johnston 2015-01-30 10:48:47 +00:00
parent c1c7b39827
commit c1d860870b
2 changed files with 9 additions and 2 deletions

View File

@ -366,12 +366,15 @@ class FederationServer(object):
logger.debug("Processed pdu %s", event_id) logger.debug("Processed pdu %s", event_id)
else: else:
logger.warn("Failed to get PDU %s", event_id) logger.warn("Failed to get PDU %s", event_id)
fetch_state = True
except: except:
# TODO(erikj): Do some more intelligent retries. # TODO(erikj): Do some more intelligent retries.
logger.exception("Failed to get PDU") logger.exception("Failed to get PDU")
fetch_state = True fetch_state = True
else: else:
fetch_state = True fetch_state = True
else:
fetch_state = True
if fetch_state: if fetch_state:
# We need to get the state at this event, since we haven't # We need to get the state at this event, since we haven't

View File

@ -119,7 +119,7 @@ class FederationHandler(BaseHandler):
event.room_id, event.room_id,
self.server_name self.server_name
) )
if not is_in_room and not event.internal_metadata.outlier: if not is_in_room and not event.internal_metadata.is_outlier():
logger.debug("Got event for room we're not in.") logger.debug("Got event for room we're not in.")
replication = self.replication_layer replication = self.replication_layer
@ -780,6 +780,7 @@ class FederationHandler(BaseHandler):
(e.type, e.state_key): e for e in remote_auth_chain (e.type, e.state_key): e for e in remote_auth_chain
if e.event_id in auth_ids if e.event_id in auth_ids
} }
e.internal_metadata.outlier = True
yield self._handle_new_event( yield self._handle_new_event(
origin, e, auth_events=auth origin, e, auth_events=auth
) )
@ -787,6 +788,8 @@ class FederationHandler(BaseHandler):
except AuthError: except AuthError:
pass pass
# FIXME: Assumes we have and stored all the state for all the
# prev_events
current_state = set(e.event_id for e in auth_events.values()) current_state = set(e.event_id for e in auth_events.values())
different_auth = event_auth_events - current_state different_auth = event_auth_events - current_state
@ -814,6 +817,7 @@ class FederationHandler(BaseHandler):
(e.type, e.state_key): e for e in result["auth_chain"] (e.type, e.state_key): e for e in result["auth_chain"]
if e.event_id in auth_ids if e.event_id in auth_ids
} }
e.internal_metadata.outlier = True
yield self._handle_new_event( yield self._handle_new_event(
origin, e, auth_events=auth origin, e, auth_events=auth
) )
@ -882,7 +886,7 @@ class FederationHandler(BaseHandler):
missing_remotes = [] missing_remotes = []
missing_locals = [] missing_locals = []
while current_local and current_remote: while current_local or current_remote:
if current_remote is None: if current_remote is None:
missing_locals.append(current_local) missing_locals.append(current_local)
current_local = get_next(local_iter) current_local = get_next(local_iter)