aboutsummaryrefslogtreecommitdiff
path: root/tool/sqlite3_rsync.c
diff options
context:
space:
mode:
authordrh <>2025-05-03 07:00:51 +0000
committerdrh <>2025-05-03 07:00:51 +0000
commite2826db73ab4595754ab13d057099b705401272c (patch)
treefdfa1b98d9d23ae6d5ed33c09b7d804c24f5ce93 /tool/sqlite3_rsync.c
parent5f4d013732211afd08584e078bb02fdc0737a314 (diff)
downloadsqlite-e2826db73ab4595754ab13d057099b705401272c.tar.gz
sqlite-e2826db73ab4595754ab13d057099b705401272c.zip
Improvements to protocol negotiation.
FossilOrigin-Name: 4f5a06e42010c3e047429f736ffb8e2e89a1eb599277c176945b57710f6713ca
Diffstat (limited to 'tool/sqlite3_rsync.c')
-rw-r--r--tool/sqlite3_rsync.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tool/sqlite3_rsync.c b/tool/sqlite3_rsync.c
index cc770ea92..760559aec 100644
--- a/tool/sqlite3_rsync.c
+++ b/tool/sqlite3_rsync.c
@@ -1339,6 +1339,9 @@ static void originSide(SQLiteRsync *p){
writePow2(p, szPg);
writeUint32(p, nPage);
fflush(p->pOut);
+ if( p->zDebugFile ){
+ debugMessage(p, "-> ORIGIN_BEGIN %u %u %u\n", p->iProtocol,szPg,nPage);
+ }
p->nPage = nPage;
p->szPage = szPg;
lockBytePage = (1<<30)/szPg + 1;
@@ -1363,6 +1366,7 @@ static void originSide(SQLiteRsync *p){
writeByte(p, p->iProtocol);
writePow2(p, p->szPage);
writeUint32(p, p->nPage);
+ fflush(p->pOut);
if( p->zDebugFile ){
debugMessage(p, "-> ORIGIN_BEGIN %d %d %u\n", p->iProtocol,
p->szPage, p->nPage);
@@ -1694,6 +1698,7 @@ static void replicaSide(SQLiteRsync *p){
writeByte(p, REPLICA_END);
fflush(p->pOut);
}
+ if( p->iProtocol<=0 ) p->iProtocol = PROTOCOL_VERSION;
/* Respond to message from the origin. The origin will initiate the
** the conversation with an ORIGIN_BEGIN message.
@@ -1716,7 +1721,7 @@ static void replicaSide(SQLiteRsync *p){
szOPage = readPow2(p);
readUint32(p, &nOPage);
if( p->zDebugFile ){
- debugMessage(p, "<- ORIGIN_BEGIN %d %d %u\n", p->iProtocol, szOPage,
+ debugMessage(p, "<- ORIGIN_BEGIN %d %d %u\n", iProtocol, szOPage,
nOPage);
}
if( p->nErr ) break;
@@ -1727,6 +1732,7 @@ static void replicaSide(SQLiteRsync *p){
** a new ORIGIN_BEGIN with a reduced protocol version. */
writeByte(p, REPLICA_BEGIN);
writeByte(p, p->iProtocol);
+ fflush(p->pOut);
if( p->zDebugFile ){
debugMessage(p, "-> REPLICA_BEGIN %u\n", p->iProtocol);
}