mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 11:23:11 -06:00
Some changes
This commit is contained in:
parent
5183f48672
commit
94794485e0
|
|
@ -1,10 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
<<<<<<< HEAD
|
for db in account device mediaapi syncapi roomserver serverkey federationsender publicroomsapi appservice naffka encryptapi; do
|
||||||
for db in account device mediaapi syncapi roomserver serverkey federationsender publicroomsapi appservice naffka; do
|
|
||||||
createdb -U dendrite -O dendrite dendrite_$db
|
|
||||||
=======
|
|
||||||
for db in account device mediaapi syncapi roomserver serverkey federationsender publicroomsapi naffka encryptapi; do
|
|
||||||
createdb -O dendrite dendrite_$db
|
createdb -O dendrite dendrite_$db
|
||||||
>>>>>>> 8b4b3c6fc46900e9bfe5e234eda309200662b34a
|
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,18 @@ func UploadPKeys(
|
||||||
&keySpecific,
|
&keySpecific,
|
||||||
userID, deviceID)
|
userID, deviceID)
|
||||||
// numMap is algorithm-num map
|
// numMap is algorithm-num map
|
||||||
numMap := (QueryOneTimeKeys(
|
numMap, ok := (QueryOneTimeKeys(
|
||||||
req.Context(),
|
req.Context(),
|
||||||
TYPESUM,
|
TYPESUM,
|
||||||
userID,
|
userID,
|
||||||
deviceID,
|
deviceID,
|
||||||
encryptionDB)).(map[string]int)
|
encryptionDB)).(map[string]int)
|
||||||
|
if !ok {
|
||||||
|
return util.JSONResponse{
|
||||||
|
Code: http.StatusInternalServerError,
|
||||||
|
JSON: struct{}{},
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadGateway,
|
Code: http.StatusBadGateway,
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,10 @@ package sync
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"sync"
|
||||||
|
|
||||||
encryptoapi "github.com/matrix-org/dendrite/encryptoapi/storage"
|
encryptoapi "github.com/matrix-org/dendrite/encryptoapi/storage"
|
||||||
"github.com/matrix-org/dendrite/syncapi/types"
|
"github.com/matrix-org/dendrite/syncapi/types"
|
||||||
"sync"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type keyCounter struct {
|
type keyCounter struct {
|
||||||
|
|
@ -55,10 +56,10 @@ func KeyCountEXT(
|
||||||
respOut = &respIn
|
respOut = &respIn
|
||||||
// when extension works at the very beginning
|
// when extension works at the very beginning
|
||||||
resp, err := encryptionDB.SyncOneTimeCount(ctx, userID, deviceID)
|
resp, err := encryptionDB.SyncOneTimeCount(ctx, userID, deviceID)
|
||||||
CounterWrite(userID, resp)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
CounterWrite(userID, resp)
|
||||||
respOut.SignNum = resp
|
respOut.SignNum = resp
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ func NewRequestPool(db *storage.SyncServerDatasource, n *Notifier, adb *accounts
|
||||||
// called in a dedicated goroutine for this request. This function will block the goroutine
|
// called in a dedicated goroutine for this request. This function will block the goroutine
|
||||||
// until a response is ready, or it times out.
|
// until a response is ready, or it times out.
|
||||||
func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtypes.Device, encryptDB *encryptoapi.Database) util.JSONResponse {
|
func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtypes.Device, encryptDB *encryptoapi.Database) util.JSONResponse {
|
||||||
var syncData *types.Response
|
var syncData *types.Response
|
||||||
// Extract values from request
|
// Extract values from request
|
||||||
logger := util.GetLogger(req.Context())
|
logger := util.GetLogger(req.Context())
|
||||||
userID := device.UserID
|
userID := device.UserID
|
||||||
|
|
@ -115,12 +115,11 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtype
|
||||||
// of calculating the sync only to get timed out before we
|
// of calculating the sync only to get timed out before we
|
||||||
// can respond
|
// can respond
|
||||||
|
|
||||||
// syncData, err = rp.currentSyncForUser(*syncReq, currPos)
|
syncData, err = rp.currentSyncForUser(*syncReq, currPos)
|
||||||
syncData, err := rp.currentSyncForUser(*syncReq, currPos)
|
|
||||||
|
|
||||||
// std extension consideration
|
// std extension consideration
|
||||||
// Have to check which "position" must be used here
|
// Have to check which "position" must be used here
|
||||||
// syncData = storage.StdEXT(syncReq.ctx, rp.db, *syncData, syncReq.device.UserID, syncReq.device.ID, int64(currPos))
|
syncData = storage.StdEXT(syncReq.ctx, rp.db, *syncData, syncReq.device.UserID, syncReq.device.ID, currPos.TypingPosition) // int64(currPos))
|
||||||
syncData = KeyCountEXT(syncReq.ctx, encryptDB, *syncData, syncReq.device.UserID, syncReq.device.ID)
|
syncData = KeyCountEXT(syncReq.ctx, encryptDB, *syncData, syncReq.device.UserID, syncReq.device.ID)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue