Fossil SCM
More fixes to the transfer protocol for reporting on private phantoms.
Commit
ec93507424a572459b1d034f9f6ff64f2786718bca0f224cd7159e4e8f78118f
Parent
50a7f89a77e0886…
1 file changed
+12
-4
+12
-4
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1316,30 +1316,37 @@ | ||
| 1316 | 1316 | && blob_eq(&xfer.aToken[0], "igot") |
| 1317 | 1317 | && blob_is_hname(&xfer.aToken[1]) |
| 1318 | 1318 | ){ |
| 1319 | 1319 | if( isPush ){ |
| 1320 | 1320 | int rid = 0; |
| 1321 | + int isPriv = 0; | |
| 1321 | 1322 | if( xfer.nToken==2 || blob_eq(&xfer.aToken[2],"1")==0 ){ |
| 1322 | 1323 | /* Client says the artifact is public */ |
| 1323 | 1324 | rid = rid_from_uuid(&xfer.aToken[1], 1, 0); |
| 1324 | 1325 | }else if( g.perm.Private ){ |
| 1325 | 1326 | /* Client says the artifact is private and the client has |
| 1326 | 1327 | ** permission to push private content. Create a new phantom |
| 1327 | 1328 | ** artifact that is marked private. */ |
| 1328 | 1329 | rid = rid_from_uuid(&xfer.aToken[1], 1, 1); |
| 1330 | + isPriv = 1; | |
| 1329 | 1331 | }else{ |
| 1330 | 1332 | /* Client says the artifact is private and the client is unable |
| 1331 | 1333 | ** or unwilling to send us the artifact. If we already hold the |
| 1332 | 1334 | ** artifact here on the server as a phantom, make sure that |
| 1333 | 1335 | ** phantom is marked as private so that we don't keep asking about |
| 1334 | 1336 | ** it in subsequent sync requests. */ |
| 1335 | 1337 | 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 ){ | |
| 1337 | 1343 | content_make_private(rid); |
| 1344 | + }else{ | |
| 1345 | + content_make_public(rid); | |
| 1338 | 1346 | } |
| 1339 | 1347 | } |
| 1340 | - if( rid ) remote_has(rid); | |
| 1341 | 1348 | } |
| 1342 | 1349 | }else |
| 1343 | 1350 | |
| 1344 | 1351 | |
| 1345 | 1352 | /* pull SERVERCODE PROJECTCODE |
| @@ -2442,11 +2449,11 @@ | ||
| 2442 | 2449 | ** |
| 2443 | 2450 | ** The servger announces to the server what version of Fossil it |
| 2444 | 2451 | ** is running. The DATE and TIME are a pure numeric ISO8601 time |
| 2445 | 2452 | ** for the specific check-in of the client. |
| 2446 | 2453 | */ |
| 2447 | - if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "client-version") ){ | |
| 2454 | + if( xfer.nToken>=3 && blob_eq(&xfer.aToken[1], "server-version") ){ | |
| 2448 | 2455 | xfer.remoteVersion = atoi(blob_str(&xfer.aToken[2])); |
| 2449 | 2456 | if( xfer.nToken>=5 ){ |
| 2450 | 2457 | xfer.remoteDate = atoi(blob_str(&xfer.aToken[3])); |
| 2451 | 2458 | xfer.remoteTime = atoi(blob_str(&xfer.aToken[4])); |
| 2452 | 2459 | } |
| @@ -2577,13 +2584,14 @@ | ||
| 2577 | 2584 | xfer.nDanglingFile = 0; |
| 2578 | 2585 | |
| 2579 | 2586 | /* If we have one or more files queued to send, then go |
| 2580 | 2587 | ** another round |
| 2581 | 2588 | */ |
| 2582 | - if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush || xfer.nPrivIGot>0 ){ | |
| 2589 | + if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush ){ | |
| 2583 | 2590 | go = 1; |
| 2584 | 2591 | } |
| 2592 | + if( xfer.nPrivIGot>0 && nCycle==1 ) go = 1; | |
| 2585 | 2593 | |
| 2586 | 2594 | /* If this is a clone, the go at least two rounds */ |
| 2587 | 2595 | if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1; |
| 2588 | 2596 | |
| 2589 | 2597 | /* Stop the cycle if the server sends a "clone_seqno 0" card and |
| 2590 | 2598 |
| --- 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 |