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.

drh 2020-04-13 14:22 trunk
Commit 71b6ada40fdef0b3a894a1b60b0685b53f6bdc34a7eae77ccea106501c65e36f
1 file changed +5 -1
+5 -1
--- src/xfer.c
+++ src/xfer.c
@@ -39,10 +39,11 @@
3939
Blob line; /* The current line of input */
4040
Blob aToken[6]; /* Tokenized version of line */
4141
Blob err; /* Error message text */
4242
int nToken; /* Number of tokens in line */
4343
int nIGotSent; /* Number of "igot" cards sent */
44
+ int nPrivIGot; /* Number of private "igot" cards */
4445
int nGimmeSent; /* Number of gimme cards sent */
4546
int nFileSent; /* Number of files sent */
4647
int nDeltaSent; /* Number of deltas sent */
4748
int nFileRcvd; /* Number of files received */
4849
int nDeltaRcvd; /* Number of deltas received */
@@ -558,10 +559,12 @@
558559
** at least tell the other side that the artifact exists and is
559560
** known to be private. But only do this for newer clients since
560561
** older ones will throw an error if they get a private igot card
561562
** and private syncing is disallowed */
562563
blob_appendf(pXfer->pOut, "igot %b 1\n", pUuid);
564
+ pXfer->nIGotSent++;
565
+ pXfer->nPrivIGot++;
563566
}
564567
return;
565568
}
566569
if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) ||
567570
pXfer->mxSend<=blob_size(pXfer->pOut) ){
@@ -2112,10 +2115,11 @@
21122115
nCardRcvd = 0;
21132116
xfer.nFileSent = 0;
21142117
xfer.nDeltaSent = 0;
21152118
xfer.nGimmeSent = 0;
21162119
xfer.nIGotSent = 0;
2120
+ xfer.nPrivIGot = 0;
21172121
21182122
lastPctDone = -1;
21192123
blob_reset(&send);
21202124
blob_appendf(&send, "pragma client-version %d %d %d\n",
21212125
RELEASE_VERSION_NUMBER, MANIFEST_NUMERIC_DATE,
@@ -2570,11 +2574,11 @@
25702574
xfer.nDanglingFile = 0;
25712575
25722576
/* If we have one or more files queued to send, then go
25732577
** another round
25742578
*/
2575
- if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush ){
2579
+ if( xfer.nFileSent+xfer.nDeltaSent>0 || uvDoPush || xfer.nPrivIGot>0 ){
25762580
go = 1;
25772581
}
25782582
25792583
/* If this is a clone, the go at least two rounds */
25802584
if( (syncFlags & SYNC_CLONE)!=0 && nCycle==1 ) go = 1;
25812585
--- 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

Keyboard Shortcuts

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