diff options
author | drh <> | 2025-05-03 07:00:51 +0000 |
---|---|---|
committer | drh <> | 2025-05-03 07:00:51 +0000 |
commit | e2826db73ab4595754ab13d057099b705401272c (patch) | |
tree | fdfa1b98d9d23ae6d5ed33c09b7d804c24f5ce93 /tool/sqlite3_rsync.c | |
parent | 5f4d013732211afd08584e078bb02fdc0737a314 (diff) | |
download | sqlite-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.c | 8 |
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); } |