Fossil SCM

More fixes to the transfer protocol for reporting on private phantoms.

drh 2020-04-13 15:20 trunk
Commit ec93507424a572459b1d034f9f6ff64f2786718bca0f224cd7159e4e8f78118f
1 file changed +12 -4
+12 -4
--- src/xfer.c
+++ src/xfer.c
@@ -1316,30 +1316,37 @@
13161316
&& blob_eq(&xfer.aToken[0], "igot")
13171317
&& blob_is_hname(&xfer.aToken[1])
13181318
){
13191319
if( isPush ){
13201320
int rid = 0;
1321
+ int isPriv = 0;
13211322
if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
13221323
/* Client says the artifact is public */
13231324
rid = rid_from_uuid(&xfer.aToken[1], 1, 0);
13241325
}else if( g.perm.Private ){
13251326
/* Client says the artifact is private and the client has
13261327
** permission to push private content. Create a new phantom
13271328
** artifact that is marked private. */
13281329
rid = rid_from_uuid(&xfer.aToken[1], 1, 1);
1330
+ isPriv = 1;
13291331
}else{
13301332
/* Client says the artifact is private and the client is unable
13311333
** or unwilling to send us the artifact. If we already hold the
13321334
** artifact here on the server as a phantom, make sure that
13331335
** phantom is marked as private so that we don't keep asking about
13341336
** it in subsequent sync requests. */
13351337
rid = rid_from_uuid(&xfer.aToken[1], 0, 1);
1336
- if( rid>0 ){
1338
+ isPriv = 1;
1339
+ }
1340
+ if( rid ){
1341
+ remote_has(rid);
1342
+ if( isPriv ){
13371343
content_make_private(rid);
1344
+ }else{
1345
+ content_make_public(rid);
13381346
}
13391347
}
1340
- if( rid ) remote_has(rid);
13411348
}
13421349
}else
13431350
13441351
13451352
/* pull SERVERCODE PROJECTCODE
@@ -2442,11 +2449,11 @@
24422449
**
24432450
** The servger announces to the server what version of Fossil it
24442451
** is running. The DATE and TIME are a pure numeric ISO8601 time
24452452
** for the specific check-in of the client.
24462453
*/
2447
- if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
2454
+ if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "server-version") ){
24482455
xfer.remoteVersion = atoi(blob_str(&xfer.aToken[2]));
24492456
if( xfer.nToken>=5 ){
24502457
xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
24512458
xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
24522459
}
@@ -2577,13 +2584,14 @@
25772584
xfer.nDanglingFile = 0;
25782585
25792586
/* If we have one or more files queued to send, then go
25802587
** another round
25812588
*/
2582
- if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush || xfer.nPrivIGot>0 ){
2589
+ if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush ){
25832590
go = 1;
25842591
}
2592
+ if( xfer.nPrivIGot>0 && nCycle==1 ) go = 1;
25852593
25862594
/* If this is a clone, the go at least two rounds */
25872595
if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1;
25882596
25892597
/* Stop the cycle if the server sends a "clone_seqno 0" card and
25902598
--- src/xfer.c
+++ src/xfer.c
@@ -1316,30 +1316,37 @@
1316 && blob_eq(&xfer.aToken[0], "igot")
1317 && blob_is_hname(&xfer.aToken[1])
1318 ){
1319 if( isPush ){
1320 int rid = 0;
 
1321 if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
1322 /* Client says the artifact is public */
1323 rid = rid_from_uuid(&xfer.aToken[1], 1, 0);
1324 }else if( g.perm.Private ){
1325 /* Client says the artifact is private and the client has
1326 ** permission to push private content. Create a new phantom
1327 ** artifact that is marked private. */
1328 rid = rid_from_uuid(&xfer.aToken[1], 1, 1);
 
1329 }else{
1330 /* Client says the artifact is private and the client is unable
1331 ** or unwilling to send us the artifact. If we already hold the
1332 ** artifact here on the server as a phantom, make sure that
1333 ** phantom is marked as private so that we don't keep asking about
1334 ** it in subsequent sync requests. */
1335 rid = rid_from_uuid(&xfer.aToken[1], 0, 1);
1336 if( rid>0 ){
 
 
 
 
1337 content_make_private(rid);
 
 
1338 }
1339 }
1340 if( rid ) remote_has(rid);
1341 }
1342 }else
1343
1344
1345 /* pull SERVERCODE PROJECTCODE
@@ -2442,11 +2449,11 @@
2442 **
2443 ** The servger announces to the server what version of Fossil it
2444 ** is running. The DATE and TIME are a pure numeric ISO8601 time
2445 ** for the specific check-in of the client.
2446 */
2447 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){
2448 xfer.remoteVersion = atoi(blob_str(&xfer.aToken[2]));
2449 if( xfer.nToken>=5 ){
2450 xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
2451 xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
2452 }
@@ -2577,13 +2584,14 @@
2577 xfer.nDanglingFile = 0;
2578
2579 /* If we have one or more files queued to send, then go
2580 ** another round
2581 */
2582 if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush || xfer.nPrivIGot>0 ){
2583 go = 1;
2584 }
 
2585
2586 /* If this is a clone, the go at least two rounds */
2587 if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1;
2588
2589 /* Stop the cycle if the server sends a "clone_seqno 0" card and
2590
--- src/xfer.c
+++ src/xfer.c
@@ -1316,30 +1316,37 @@
1316 && blob_eq(&xfer.aToken[0], "igot")
1317 && blob_is_hname(&xfer.aToken[1])
1318 ){
1319 if( isPush ){
1320 int rid = 0;
1321 int isPriv = 0;
1322 if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){
1323 /* Client says the artifact is public */
1324 rid = rid_from_uuid(&xfer.aToken[1], 1, 0);
1325 }else if( g.perm.Private ){
1326 /* Client says the artifact is private and the client has
1327 ** permission to push private content. Create a new phantom
1328 ** artifact that is marked private. */
1329 rid = rid_from_uuid(&xfer.aToken[1], 1, 1);
1330 isPriv = 1;
1331 }else{
1332 /* Client says the artifact is private and the client is unable
1333 ** or unwilling to send us the artifact. If we already hold the
1334 ** artifact here on the server as a phantom, make sure that
1335 ** phantom is marked as private so that we don't keep asking about
1336 ** it in subsequent sync requests. */
1337 rid = rid_from_uuid(&xfer.aToken[1], 0, 1);
1338 isPriv = 1;
1339 }
1340 if( rid ){
1341 remote_has(rid);
1342 if( isPriv ){
1343 content_make_private(rid);
1344 }else{
1345 content_make_public(rid);
1346 }
1347 }
 
1348 }
1349 }else
1350
1351
1352 /* pull SERVERCODE PROJECTCODE
@@ -2442,11 +2449,11 @@
2449 **
2450 ** The servger announces to the server what version of Fossil it
2451 ** is running. The DATE and TIME are a pure numeric ISO8601 time
2452 ** for the specific check-in of the client.
2453 */
2454 if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "server-version") ){
2455 xfer.remoteVersion = atoi(blob_str(&xfer.aToken[2]));
2456 if( xfer.nToken>=5 ){
2457 xfer.remoteDate = atoi(blob_str(&xfer.aToken[3]));
2458 xfer.remoteTime = atoi(blob_str(&xfer.aToken[4]));
2459 }
@@ -2577,13 +2584,14 @@
2584 xfer.nDanglingFile = 0;
2585
2586 /* If we have one or more files queued to send, then go
2587 ** another round
2588 */
2589 if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush ){
2590 go = 1;
2591 }
2592 if( xfer.nPrivIGot>0 && nCycle==1 ) go = 1;
2593
2594 /* If this is a clone, the go at least two rounds */
2595 if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1;
2596
2597 /* Stop the cycle if the server sends a "clone_seqno 0" card and
2598

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button