mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
make FederationClient.send_join async
This commit is contained in:
parent
3f11cbb404
commit
8af9f11bea
@ -17,7 +17,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict, Iterable, List, Optional, Tuple
|
from typing import Any, Dict, Iterable, List, Optional, Tuple
|
||||||
|
|
||||||
from prometheus_client import Counter
|
from prometheus_client import Counter
|
||||||
|
|
||||||
@ -496,27 +496,29 @@ class FederationClient(FederationBase):
|
|||||||
"make_" + membership, destinations, send_request
|
"make_" + membership, destinations, send_request
|
||||||
)
|
)
|
||||||
|
|
||||||
def send_join(self, destinations, pdu, event_format_version):
|
async def send_join(
|
||||||
|
self, destinations: Iterable[str], pdu: EventBase, event_format_version: int
|
||||||
|
) -> Dict[str, Any]:
|
||||||
"""Sends a join event to one of a list of homeservers.
|
"""Sends a join event to one of a list of homeservers.
|
||||||
|
|
||||||
Doing so will cause the remote server to add the event to the graph,
|
Doing so will cause the remote server to add the event to the graph,
|
||||||
and send the event out to the rest of the federation.
|
and send the event out to the rest of the federation.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
destinations (str): Candidate homeservers which are probably
|
destinations: Candidate homeservers which are probably
|
||||||
participating in the room.
|
participating in the room.
|
||||||
pdu (BaseEvent): event to be sent
|
pdu: event to be sent
|
||||||
event_format_version (int): The event format version
|
event_format_version: The event format version
|
||||||
|
|
||||||
Return:
|
Returns:
|
||||||
Deferred: resolves to a dict with members ``origin`` (a string
|
a dict with members ``origin`` (a string
|
||||||
giving the serer the event was sent to, ``state`` (?) and
|
giving the serer the event was sent to, ``state`` (?) and
|
||||||
``auth_chain``.
|
``auth_chain``.
|
||||||
|
|
||||||
Fails with a ``SynapseError`` if the chosen remote server
|
Raises:
|
||||||
returns a 300/400 code.
|
SynapseError: if the chosen remote server returns a 300/400 code.
|
||||||
|
|
||||||
Fails with a ``RuntimeError`` if no servers were reachable.
|
RuntimeError: if no servers were reachable.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def check_authchain_validity(signed_auth_chain):
|
def check_authchain_validity(signed_auth_chain):
|
||||||
@ -603,7 +605,7 @@ class FederationClient(FederationBase):
|
|||||||
"origin": destination,
|
"origin": destination,
|
||||||
}
|
}
|
||||||
|
|
||||||
return self._try_destination_list("send_join", destinations, send_request)
|
return await self._try_destination_list("send_join", destinations, send_request)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _do_send_join(self, destination, pdu):
|
def _do_send_join(self, destination, pdu):
|
||||||
|
Loading…
Reference in New Issue
Block a user