From e2826db73ab4595754ab13d057099b705401272c Mon Sep 17 00:00:00 2001 From: drh <> Date: Sat, 3 May 2025 07:00:51 +0000 Subject: [PATCH] Improvements to protocol negotiation. FossilOrigin-Name: 4f5a06e42010c3e047429f736ffb8e2e89a1eb599277c176945b57710f6713ca --- manifest | 12 ++++++------ manifest.uuid | 2 +- tool/sqlite3_rsync.c | 8 +++++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 42c215830d..565a024081 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Clean\sup\scommand-line\sparsing.\s\sAdd\sthe\sundocumented\s\n-protocol\soption\sfor\sdebugging. -D 2025-05-02T23:50:30.776 +C Improvements\sto\sprotocol\snegotiation. +D 2025-05-03T07:00:51.378 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -2189,7 +2189,7 @@ F tool/spellsift.tcl 52b4b04dc4333c7ab024f09d9d66ed6b6f7c6eb00b38497a09f338fa55d F tool/split-sqlite3c.tcl 07e18a1d8cc3f6b3a4a1f3528e63c9b29a5c8a7bca0b8d394b231da464ce1247 F tool/sqldiff.c 134be7866be19f8beb32043d5aea5657f01aaeae2df8d33d758ff722c78666b9 F tool/sqlite3_analyzer.c.in 14f02cb5ec3c264cd6107d1f1dad77092b1cf440fc196c30b69ae87b56a1a43b -F tool/sqlite3_rsync.c 97ec284a12ccf4203ace717cb1943ac652e2723d86ef0acfca517b270516e85c +F tool/sqlite3_rsync.c 756ad79858feaf050a9ff60ffdb201a7a2b6a1ee620ede5743a0cef51defcdc0 F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 F tool/src-verify.c d00f93263aa2fa6ba0cba0106d95458e6effb94fdb5fc634f56834f90c05bbb4 @@ -2207,8 +2207,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P cb035181d9fb5909696b8ec8f9c3eeb7a7dfb4b50e82e1d3f2d5ad150afcc0ff -R d99c926bcfda0557c90ab8e625e5e88b +P 2a52b174e6e91cd7cfca0b20b39cdd231f377c7bc073f4223574556b94b16aa5 +R 2857adf0e10b56883ce6697a283afd6e U drh -Z 1169e74b2b686e6aa9ef554d4d02a6d5 +Z c7d74e185dc3b48152bf82febe4de310 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 12ac9e6258..f3b4164d07 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2a52b174e6e91cd7cfca0b20b39cdd231f377c7bc073f4223574556b94b16aa5 +4f5a06e42010c3e047429f736ffb8e2e89a1eb599277c176945b57710f6713ca diff --git a/tool/sqlite3_rsync.c b/tool/sqlite3_rsync.c index cc770ea922..760559aec2 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); } -- 2.39.5