Some changes

This commit is contained in:
SUMUKHA-PK 2019-10-18 20:04:39 +05:30
parent 5183f48672
commit 94794485e0
4 changed files with 14 additions and 13 deletions

View file

@ -1,10 +1,5 @@
#!/bin/bash
<<<<<<< HEAD
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
for db in account device mediaapi syncapi roomserver serverkey federationsender publicroomsapi appservice naffka encryptapi; do
createdb -O dendrite dendrite_$db
>>>>>>> 8b4b3c6fc46900e9bfe5e234eda309200662b34a
done

View file

@ -78,12 +78,18 @@ func UploadPKeys(
&keySpecific,
userID, deviceID)
// numMap is algorithm-num map
numMap := (QueryOneTimeKeys(
numMap, ok := (QueryOneTimeKeys(
req.Context(),
TYPESUM,
userID,
deviceID,
encryptionDB)).(map[string]int)
if !ok {
return util.JSONResponse{
Code: http.StatusInternalServerError,
JSON: struct{}{},
}
}
if err != nil {
return util.JSONResponse{
Code: http.StatusBadGateway,

View file

@ -16,9 +16,10 @@ package sync
import (
"context"
"sync"
encryptoapi "github.com/matrix-org/dendrite/encryptoapi/storage"
"github.com/matrix-org/dendrite/syncapi/types"
"sync"
)
type keyCounter struct {
@ -55,10 +56,10 @@ func KeyCountEXT(
respOut = &respIn
// when extension works at the very beginning
resp, err := encryptionDB.SyncOneTimeCount(ctx, userID, deviceID)
CounterWrite(userID, resp)
if err != nil {
return
}
CounterWrite(userID, resp)
respOut.SignNum = resp
return
}

View file

@ -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
// until a response is ready, or it times out.
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
logger := util.GetLogger(req.Context())
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
// can respond
// syncData, err = rp.currentSyncForUser(*syncReq, currPos)
syncData, err := rp.currentSyncForUser(*syncReq, currPos)
syncData, err = rp.currentSyncForUser(*syncReq, currPos)
// std extension consideration
// 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)
if err != nil {