Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
cc3d32c6
Verified
Commit
cc3d32c6
authored
4 years ago
by
Nicolas Werner
Browse files
Options
Downloads
Patches
Plain Diff
Move check for duplicate /sync responses to the same thread
parent
0dc40e50
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#897
passed
4 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ChatPage.cpp
+12
-12
12 additions, 12 deletions
src/ChatPage.cpp
src/ChatPage.h
+3
-2
3 additions, 2 deletions
src/ChatPage.h
with
15 additions
and
14 deletions
src/ChatPage.cpp
+
12
−
12
View file @
cc3d32c6
...
...
@@ -805,8 +805,17 @@ ChatPage::startInitialSync()
}
void
ChatPage
::
handleSyncResponse
(
const
mtx
::
responses
::
Sync
&
res
)
ChatPage
::
handleSyncResponse
(
const
mtx
::
responses
::
Sync
&
res
,
const
std
::
string
&
prev_batch_token
)
{
try
{
if
(
prev_batch_token
!=
cache
::
nextBatchToken
())
{
nhlog
::
net
()
->
warn
(
"Duplicate sync, dropping"
);
return
;
}
}
catch
(
const
lmdb
::
error
&
e
)
{
nhlog
::
db
()
->
warn
(
"Logged out in the mean time, dropping sync"
);
}
nhlog
::
net
()
->
debug
(
"sync completed: {}"
,
res
.
next_batch
);
// Ensure that we have enough one-time keys available.
...
...
@@ -861,15 +870,6 @@ ChatPage::trySync()
http
::
client
()
->
sync
(
opts
,
[
this
,
since
=
opts
.
since
](
const
mtx
::
responses
::
Sync
&
res
,
mtx
::
http
::
RequestErr
err
)
{
try
{
if
(
since
!=
cache
::
nextBatchToken
())
{
nhlog
::
net
()
->
warn
(
"Duplicate sync, dropping"
);
return
;
}
}
catch
(
const
lmdb
::
error
&
e
)
{
nhlog
::
db
()
->
warn
(
"Logged out in the mean time, dropping sync"
);
}
if
(
err
)
{
const
auto
error
=
QString
::
fromStdString
(
err
->
matrix_error
.
error
);
const
auto
msg
=
tr
(
"Please try to login again: %1"
).
arg
(
error
);
...
...
@@ -895,7 +895,7 @@ ChatPage::trySync()
return
;
}
emit
newSyncResponse
(
res
);
emit
newSyncResponse
(
res
,
since
);
});
}
...
...
@@ -1448,4 +1448,4 @@ void
ChatPage
::
highlightRoom
(
const
QString
&
room_id
)
{
room_list_
->
highlightSelectedRoom
(
room_id
);
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
src/ChatPage.h
+
3
−
2
View file @
cc3d32c6
...
...
@@ -141,7 +141,7 @@ signals:
void
trySyncCb
();
void
tryDelayedSyncCb
();
void
tryInitialSyncCb
();
void
newSyncResponse
(
const
mtx
::
responses
::
Sync
&
res
);
void
newSyncResponse
(
const
mtx
::
responses
::
Sync
&
res
,
const
std
::
string
&
prev_batch_token
);
void
leftRoom
(
const
QString
&
room_id
);
void
newRoom
(
const
QString
&
room_id
);
...
...
@@ -194,7 +194,8 @@ private slots:
void
changeRoom
(
const
QString
&
room_id
);
void
dropToLoginPage
(
const
QString
&
msg
);
void
handleSyncResponse
(
const
mtx
::
responses
::
Sync
&
res
);
void
handleSyncResponse
(
const
mtx
::
responses
::
Sync
&
res
,
const
std
::
string
&
prev_batch_token
);
private
:
static
ChatPage
*
instance_
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment