mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 19:33:09 -06:00
Fix zero value of currPos may be used in OnIncomingSyncRequest
Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
parent
6fd1c21207
commit
274db2fbaf
|
|
@ -63,9 +63,11 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtype
|
||||||
"timeout": syncReq.timeout,
|
"timeout": syncReq.timeout,
|
||||||
}).Info("Incoming /sync request")
|
}).Info("Incoming /sync request")
|
||||||
|
|
||||||
|
currPos := rp.notifier.CurrentPosition()
|
||||||
|
|
||||||
// If this is an initial sync or timeout=0 we return immediately
|
// If this is an initial sync or timeout=0 we return immediately
|
||||||
if syncReq.since == nil || syncReq.timeout == 0 {
|
if syncReq.since == nil || syncReq.timeout == 0 {
|
||||||
syncData, err = rp.currentSyncForUser(*syncReq, rp.notifier.CurrentPosition())
|
syncData, err = rp.currentSyncForUser(*syncReq, currPos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return httputil.LogThenError(req, err)
|
return httputil.LogThenError(req, err)
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +92,6 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *authtype
|
||||||
// respond with, so we skip the return an go back to waiting for content to
|
// respond with, so we skip the return an go back to waiting for content to
|
||||||
// be sent down or the request timing out.
|
// be sent down or the request timing out.
|
||||||
var hasTimedOut bool
|
var hasTimedOut bool
|
||||||
var currPos types.SyncPosition
|
|
||||||
sincePos := *syncReq.since
|
sincePos := *syncReq.since
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue