This commit is contained in:
Kegan Dougal 2020-08-05 13:00:21 +01:00
parent 617862e40c
commit 2a0c160148
2 changed files with 22 additions and 13 deletions

View file

@ -313,10 +313,18 @@ func (t *txnReq) processEDUs(edus []gomatrixserverlib.EDU) {
}
}
case gomatrixserverlib.MDeviceListUpdate:
t.processDeviceListUpdate(e)
default:
util.GetLogger(t.context).WithField("type", e.Type).Warn("unhandled edu")
}
}
}
func (t *txnReq) processDeviceListUpdate(e gomatrixserverlib.EDU) {
var payload gomatrixserverlib.DeviceListUpdateEvent
if err := json.Unmarshal(e.Content, &payload); err != nil {
util.GetLogger(t.context).WithError(err).Error("Failed to unmarshal device list update event")
continue
return
}
var inputRes keyapi.InputDeviceListUpdateResponse
t.keyAPI.InputDeviceListUpdate(context.Background(), &keyapi.InputDeviceListUpdateRequest{
@ -325,10 +333,6 @@ func (t *txnReq) processEDUs(edus []gomatrixserverlib.EDU) {
if inputRes.Error != nil {
util.GetLogger(t.context).WithError(inputRes.Error).WithField("user_id", payload.UserID).Error("failed to InputDeviceListUpdate")
}
default:
util.GetLogger(t.context).WithField("type", e.Type).Warn("unhandled edu")
}
}
}
func (t *txnReq) processEvent(e gomatrixserverlib.Event, isInboundTxn bool) error {

View file

@ -95,7 +95,12 @@ func (a *KeyInternalAPI) InputDeviceListUpdate(
}
// ALWAYS emit key changes when we've been poked over federation just in case
// this poke is important for something.
a.Producer.ProduceKeyChanges(keys)
err = a.Producer.ProduceKeyChanges(keys)
if err != nil {
res.Error = &api.KeyError{
Err: fmt.Sprintf("failed to emit remote device key changes: %s", err),
}
}
return
}