Fossil SCM
Adjust the xfer handler to go another round if any igot cards were sent in response to a gimme for a private artifact.
Commit
71b6ada40fdef0b3a894a1b60b0685b53f6bdc34a7eae77ccea106501c65e36f
Parent
a0faf128db08cef…
1 file changed
+5
-1
+5
-1
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -39,10 +39,11 @@ | ||
| 39 | 39 | Blob line; /* The current line of input */ |
| 40 | 40 | Blob aToken[6]; /* Tokenized version of line */ |
| 41 | 41 | Blob err; /* Error message text */ |
| 42 | 42 | int nToken; /* Number of tokens in line */ |
| 43 | 43 | int nIGotSent; /* Number of "igot" cards sent */ |
| 44 | + int nPrivIGot; /* Number of private "igot" cards */ | |
| 44 | 45 | int nGimmeSent; /* Number of gimme cards sent */ |
| 45 | 46 | int nFileSent; /* Number of files sent */ |
| 46 | 47 | int nDeltaSent; /* Number of deltas sent */ |
| 47 | 48 | int nFileRcvd; /* Number of files received */ |
| 48 | 49 | int nDeltaRcvd; /* Number of deltas received */ |
| @@ -558,10 +559,12 @@ | ||
| 558 | 559 | ** at least tell the other side that the artifact exists and is |
| 559 | 560 | ** known to be private. But only do this for newer clients since |
| 560 | 561 | ** older ones will throw an error if they get a private igot card |
| 561 | 562 | ** and private syncing is disallowed */ |
| 562 | 563 | blob_appendf(pXfer->pOut, "igot %b 1\n", pUuid); |
| 564 | + pXfer->nIGotSent++; | |
| 565 | + pXfer->nPrivIGot++; | |
| 563 | 566 | } |
| 564 | 567 | return; |
| 565 | 568 | } |
| 566 | 569 | if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || |
| 567 | 570 | pXfer->mxSend<=blob_size(pXfer->pOut) ){ |
| @@ -2112,10 +2115,11 @@ | ||
| 2112 | 2115 | nCardRcvd = 0; |
| 2113 | 2116 | xfer.nFileSent = 0; |
| 2114 | 2117 | xfer.nDeltaSent = 0; |
| 2115 | 2118 | xfer.nGimmeSent = 0; |
| 2116 | 2119 | xfer.nIGotSent = 0; |
| 2120 | + xfer.nPrivIGot = 0; | |
| 2117 | 2121 | |
| 2118 | 2122 | lastPctDone = -1; |
| 2119 | 2123 | blob_reset(&send); |
| 2120 | 2124 | blob_appendf(&send, "pragma client-version %d %d %d\n", |
| 2121 | 2125 | RELEASE_VERSION_NUMBER, MANIFEST_NUMERIC_DATE, |
| @@ -2570,11 +2574,11 @@ | ||
| 2570 | 2574 | xfer.nDanglingFile = 0; |
| 2571 | 2575 | |
| 2572 | 2576 | /* If we have one or more files queued to send, then go |
| 2573 | 2577 | ** another round |
| 2574 | 2578 | */ |
| 2575 | - if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush ){ | |
| 2579 | + if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush || xfer.nPrivIGot>0 ){ | |
| 2576 | 2580 | go = 1; |
| 2577 | 2581 | } |
| 2578 | 2582 | |
| 2579 | 2583 | /* If this is a clone, the go at least two rounds */ |
| 2580 | 2584 | if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1; |
| 2581 | 2585 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -39,10 +39,11 @@ | |
| 39 | Blob line; /* The current line of input */ |
| 40 | Blob aToken[6]; /* Tokenized version of line */ |
| 41 | Blob err; /* Error message text */ |
| 42 | int nToken; /* Number of tokens in line */ |
| 43 | int nIGotSent; /* Number of "igot" cards sent */ |
| 44 | int nGimmeSent; /* Number of gimme cards sent */ |
| 45 | int nFileSent; /* Number of files sent */ |
| 46 | int nDeltaSent; /* Number of deltas sent */ |
| 47 | int nFileRcvd; /* Number of files received */ |
| 48 | int nDeltaRcvd; /* Number of deltas received */ |
| @@ -558,10 +559,12 @@ | |
| 558 | ** at least tell the other side that the artifact exists and is |
| 559 | ** known to be private. But only do this for newer clients since |
| 560 | ** older ones will throw an error if they get a private igot card |
| 561 | ** and private syncing is disallowed */ |
| 562 | blob_appendf(pXfer->pOut, "igot %b 1\n", pUuid); |
| 563 | } |
| 564 | return; |
| 565 | } |
| 566 | if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || |
| 567 | pXfer->mxSend<=blob_size(pXfer->pOut) ){ |
| @@ -2112,10 +2115,11 @@ | |
| 2112 | nCardRcvd = 0; |
| 2113 | xfer.nFileSent = 0; |
| 2114 | xfer.nDeltaSent = 0; |
| 2115 | xfer.nGimmeSent = 0; |
| 2116 | xfer.nIGotSent = 0; |
| 2117 | |
| 2118 | lastPctDone = -1; |
| 2119 | blob_reset(&send); |
| 2120 | blob_appendf(&send, "pragma client-version %d %d %d\n", |
| 2121 | RELEASE_VERSION_NUMBER, MANIFEST_NUMERIC_DATE, |
| @@ -2570,11 +2574,11 @@ | |
| 2570 | xfer.nDanglingFile = 0; |
| 2571 | |
| 2572 | /* If we have one or more files queued to send, then go |
| 2573 | ** another round |
| 2574 | */ |
| 2575 | if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush ){ |
| 2576 | go = 1; |
| 2577 | } |
| 2578 | |
| 2579 | /* If this is a clone, the go at least two rounds */ |
| 2580 | if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1; |
| 2581 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -39,10 +39,11 @@ | |
| 39 | Blob line; /* The current line of input */ |
| 40 | Blob aToken[6]; /* Tokenized version of line */ |
| 41 | Blob err; /* Error message text */ |
| 42 | int nToken; /* Number of tokens in line */ |
| 43 | int nIGotSent; /* Number of "igot" cards sent */ |
| 44 | int nPrivIGot; /* Number of private "igot" cards */ |
| 45 | int nGimmeSent; /* Number of gimme cards sent */ |
| 46 | int nFileSent; /* Number of files sent */ |
| 47 | int nDeltaSent; /* Number of deltas sent */ |
| 48 | int nFileRcvd; /* Number of files received */ |
| 49 | int nDeltaRcvd; /* Number of deltas received */ |
| @@ -558,10 +559,12 @@ | |
| 559 | ** at least tell the other side that the artifact exists and is |
| 560 | ** known to be private. But only do this for newer clients since |
| 561 | ** older ones will throw an error if they get a private igot card |
| 562 | ** and private syncing is disallowed */ |
| 563 | blob_appendf(pXfer->pOut, "igot %b 1\n", pUuid); |
| 564 | pXfer->nIGotSent++; |
| 565 | pXfer->nPrivIGot++; |
| 566 | } |
| 567 | return; |
| 568 | } |
| 569 | if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) || |
| 570 | pXfer->mxSend<=blob_size(pXfer->pOut) ){ |
| @@ -2112,10 +2115,11 @@ | |
| 2115 | nCardRcvd = 0; |
| 2116 | xfer.nFileSent = 0; |
| 2117 | xfer.nDeltaSent = 0; |
| 2118 | xfer.nGimmeSent = 0; |
| 2119 | xfer.nIGotSent = 0; |
| 2120 | xfer.nPrivIGot = 0; |
| 2121 | |
| 2122 | lastPctDone = -1; |
| 2123 | blob_reset(&send); |
| 2124 | blob_appendf(&send, "pragma client-version %d %d %d\n", |
| 2125 | RELEASE_VERSION_NUMBER, MANIFEST_NUMERIC_DATE, |
| @@ -2570,11 +2574,11 @@ | |
| 2574 | xfer.nDanglingFile = 0; |
| 2575 | |
| 2576 | /* If we have one or more files queued to send, then go |
| 2577 | ** another round |
| 2578 | */ |
| 2579 | if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush || xfer.nPrivIGot>0 ){ |
| 2580 | go = 1; |
| 2581 | } |
| 2582 | |
| 2583 | /* If this is a clone, the go at least two rounds */ |
| 2584 | if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1; |
| 2585 |