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

Commit

Permalink
typing: check origin server of typing event against room's servers
Browse files Browse the repository at this point in the history
This is also using the partial state approximation if needed so we do
not block here during a fast join.

Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
  • Loading branch information
Mathieu Velten committed Sep 23, 2022
1 parent efd108b commit 9ff3c3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/13830.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typing: check origin server of typing event against servers currently in the room. We also use a method that do not block on partial state so the transaction doesn't get stuck during a fast join.
6 changes: 4 additions & 2 deletions synapse/handlers/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,13 @@ async def _recv_edu(self, origin: str, content: JsonDict) -> None:
)
return

domains = await self._storage_controllers.state.get_current_hosts_in_room(
# Let's check that the origin server is in the room before accepting the typing event.
# We don't want to block waiting on a partial state so take the approximation if needed.
domains = await self._storage_controllers.state.get_current_hosts_in_room_or_partial_state_approximation(
room_id
)

if self.server_name in domains:
if user.domain in domains:
logger.info("Got typing update from %s: %r", user_id, content)
now = self.clock.time_msec()
self._member_typing_until[member] = now + FEDERATION_TIMEOUT
Expand Down

0 comments on commit 9ff3c3a

Please sign in to comment.