mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
Mark device list as stale, if we don't have the requesting device (#2728)
This hopefully makes E2EE chats a little bit more reliable by re-syncing
devices if we don't have the `requesting_device_id` in our database. (As
seen in
[Synapse](c52abc1cfd/synapse/handlers/devicemessage.py (L157-L201)
))
This commit is contained in:
parent
47af4bff5b
commit
e007b8038f
7 changed files with 76 additions and 10 deletions
|
@ -37,6 +37,7 @@ const (
|
|||
QueryOneTimeKeysPath = "/keyserver/queryOneTimeKeys"
|
||||
QueryDeviceMessagesPath = "/keyserver/queryDeviceMessages"
|
||||
QuerySignaturesPath = "/keyserver/querySignatures"
|
||||
PerformMarkAsStalePath = "/keyserver/markAsStale"
|
||||
)
|
||||
|
||||
// NewKeyServerClient creates a KeyInternalAPI implemented by talking to a HTTP POST API.
|
||||
|
@ -172,3 +173,14 @@ func (h *httpKeyInternalAPI) QuerySignatures(
|
|||
h.httpClient, ctx, request, response,
|
||||
)
|
||||
}
|
||||
|
||||
func (h *httpKeyInternalAPI) PerformMarkAsStaleIfNeeded(
|
||||
ctx context.Context,
|
||||
request *api.PerformMarkAsStaleRequest,
|
||||
response *struct{},
|
||||
) error {
|
||||
return httputil.CallInternalRPCAPI(
|
||||
"MarkAsStale", h.apiURL+PerformMarkAsStalePath,
|
||||
h.httpClient, ctx, request, response,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ package inthttp
|
|||
|
||||
import (
|
||||
"github.com/gorilla/mux"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/keyserver/api"
|
||||
)
|
||||
|
@ -70,4 +71,9 @@ func AddRoutes(internalAPIMux *mux.Router, s api.KeyInternalAPI) {
|
|||
QuerySignaturesPath,
|
||||
httputil.MakeInternalRPCAPI("KeyserverQuerySignatures", s.QuerySignatures),
|
||||
)
|
||||
|
||||
internalAPIMux.Handle(
|
||||
PerformMarkAsStalePath,
|
||||
httputil.MakeInternalRPCAPI("KeyserverMarkAsStale", s.PerformMarkAsStaleIfNeeded),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue