mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 19:03:09 -06:00
Don't send federation queries to ourselves.
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
a930c0d0b1
commit
ee86685e0b
|
|
@ -71,6 +71,8 @@ func DirectoryRoom(
|
|||
|
||||
if res.RoomID == "" {
|
||||
// If we don't know it locally, do a federation query.
|
||||
// But don't send the query to ourselves.
|
||||
if domain != cfg.Matrix.ServerName {
|
||||
fedRes, fedErr := federation.LookupRoomAlias(req.Context(), domain, roomAlias)
|
||||
if fedErr != nil {
|
||||
switch fedErr.(type) {
|
||||
|
|
@ -82,7 +84,11 @@ func DirectoryRoom(
|
|||
return httputil.LogThenError(req, fedErr)
|
||||
}
|
||||
}
|
||||
if fedRes.RoomID == "" {
|
||||
res.RoomID = fedRes.RoomID
|
||||
res.fillServers(fedRes.Servers)
|
||||
}
|
||||
|
||||
if res.RoomID == "" {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusNotFound,
|
||||
JSON: jsonerror.NotFound(
|
||||
|
|
@ -90,9 +96,6 @@ func DirectoryRoom(
|
|||
),
|
||||
}
|
||||
}
|
||||
|
||||
res.RoomID = fedRes.RoomID
|
||||
res.fillServers(fedRes.Servers)
|
||||
} else {
|
||||
joinedHostsReq := federationSenderAPI.QueryJoinedHostServerNamesInRoomRequest{RoomID: res.RoomID}
|
||||
var joinedHostsRes federationSenderAPI.QueryJoinedHostServerNamesInRoomResponse
|
||||
|
|
|
|||
Loading…
Reference in a new issue