Keep prewarmed session

This commit is contained in:
jpirnay
2026-04-09 13:35:31 +02:00
parent d05731ca82
commit 65eb8570d3
2 changed files with 9 additions and 6 deletions
@@ -266,7 +266,7 @@ void KOReaderSyncActivity::performSync() {
// still useful for manual conflict decisions. // still useful for manual conflict decisions.
// Pre-map remote progress now so compare UI always shows concrete chapter/ // Pre-map remote progress now so compare UI always shows concrete chapter/
// page data. The mapped result is cached and reused if Apply is chosen. // page data. The mapped result is cached and reused if Apply is chosen.
if (!ensureRemotePositionMapped()) { if (!ensureRemotePositionMapped(false)) {
{ {
RenderLock lock(*this); RenderLock lock(*this);
state = SYNC_FAILED; state = SYNC_FAILED;
@@ -555,14 +555,17 @@ bool KOReaderSyncActivity::ensureEpubLoadedForMapping() {
return true; return true;
} }
bool KOReaderSyncActivity::ensureRemotePositionMapped() { bool KOReaderSyncActivity::ensureRemotePositionMapped(const bool closeSessionBeforeMapping) {
if (remotePositionMapped) { if (remotePositionMapped) {
return true; return true;
} }
// Apply needs remote->local mapping, which triggers EPUB inflate work. // Mapping remote->local can trigger EPUB inflate work. For apply/pull paths,
// Release HTTP/TLS session first so mapping has maximum heap headroom. // release HTTP/TLS first to maximize heap headroom. Compare pre-map keeps
KOReaderSyncClient::endPersistentSession(); // the warmed session alive so Upload can reuse it without a fresh handshake.
if (closeSessionBeforeMapping) {
KOReaderSyncClient::endPersistentSession();
}
{ {
RenderLock lock(*this); RenderLock lock(*this);
+1 -1
View File
@@ -115,5 +115,5 @@ class KOReaderSyncActivity final : public Activity {
void releaseEpubForMapping(); void releaseEpubForMapping();
bool computeLocalProgressAndChapter(); bool computeLocalProgressAndChapter();
void computeRemoteChapter(); void computeRemoteChapter();
bool ensureRemotePositionMapped(); bool ensureRemotePositionMapped(bool closeSessionBeforeMapping = true);
}; };