Fossil SCM

Sync server sends back private igot messages for private phantoms.

drh 2020-04-13 16:56 trunk
Commit 81445afb5ca1972405e900a763fadfd28c3bd418d8c3a2be465a3feade2e769f
1 file changed +13 -13
+13 -13
--- src/xfer.c
+++ src/xfer.c
@@ -527,10 +527,23 @@
527527
static void send_file(Xfer *pXfer, int rid, Blob *pUuid, int nativeDelta){
528528
Blob content, uuid;
529529
int size = 0;
530530
int isPriv = content_is_private(rid);
531531
532
+ if( isPriv && pXfer->syncPrivate==0 ){
533
+ if( pXfer->remoteDate>=20200413 && pUuid && blob_size(pUuid)>0 ){
534
+ /* If the artifact is private and we are not doing a private sync,
535
+ ** at least tell the other side that the artifact exists and is
536
+ ** known to be private. But only do this for newer clients since
537
+ ** older ones will throw an error if they get a private igot card
538
+ ** and private syncing is disallowed */
539
+ blob_appendf(pXfer->pOut, "igot %b 1\n", pUuid);
540
+ pXfer->nIGotSent++;
541
+ pXfer->nPrivIGot++;
542
+ }
543
+ return;
544
+ }
532545
if( db_exists("SELECT 1 FROM onremote WHERE rid=%d", rid) ){
533546
return;
534547
}
535548
blob_zero(&uuid);
536549
db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d AND size>=0", rid);
@@ -549,23 +562,10 @@
549562
}else{
550563
pUuid = &uuid;
551564
}
552565
if( uuid_is_shunned(blob_str(pUuid)) ){
553566
blob_reset(&uuid);
554
- return;
555
- }
556
- if( isPriv && pXfer->syncPrivate==0 ){
557
- if( pXfer->remoteDate>=20200413 ){
558
- /* If the artifact is private and we are not doing a private sync,
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
- }
567567
return;
568568
}
569569
if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) ||
570570
pXfer->mxSend<=blob_size(pXfer->pOut) ){
571571
const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n";
572572
--- src/xfer.c
+++ src/xfer.c
@@ -527,10 +527,23 @@
527 static void send_file(Xfer *pXfer, int rid, Blob *pUuid, int nativeDelta){
528 Blob content, uuid;
529 int size = 0;
530 int isPriv = content_is_private(rid);
531
 
 
 
 
 
 
 
 
 
 
 
 
 
532 if( db_exists("SELECT 1 FROM onremote WHERE rid=%d", rid) ){
533 return;
534 }
535 blob_zero(&uuid);
536 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d AND size>=0", rid);
@@ -549,23 +562,10 @@
549 }else{
550 pUuid = &uuid;
551 }
552 if( uuid_is_shunned(blob_str(pUuid)) ){
553 blob_reset(&uuid);
554 return;
555 }
556 if( isPriv && pXfer->syncPrivate==0 ){
557 if( pXfer->remoteDate>=20200413 ){
558 /* If the artifact is private and we are not doing a private sync,
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) ){
571 const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n";
572
--- src/xfer.c
+++ src/xfer.c
@@ -527,10 +527,23 @@
527 static void send_file(Xfer *pXfer, int rid, Blob *pUuid, int nativeDelta){
528 Blob content, uuid;
529 int size = 0;
530 int isPriv = content_is_private(rid);
531
532 if( isPriv && pXfer->syncPrivate==0 ){
533 if( pXfer->remoteDate>=20200413 && pUuid && blob_size(pUuid)>0 ){
534 /* If the artifact is private and we are not doing a private sync,
535 ** at least tell the other side that the artifact exists and is
536 ** known to be private. But only do this for newer clients since
537 ** older ones will throw an error if they get a private igot card
538 ** and private syncing is disallowed */
539 blob_appendf(pXfer->pOut, "igot %b 1\n", pUuid);
540 pXfer->nIGotSent++;
541 pXfer->nPrivIGot++;
542 }
543 return;
544 }
545 if( db_exists("SELECT 1 FROM onremote WHERE rid=%d", rid) ){
546 return;
547 }
548 blob_zero(&uuid);
549 db_blob(&uuid, "SELECT uuid FROM blob WHERE rid=%d AND size>=0", rid);
@@ -549,23 +562,10 @@
562 }else{
563 pUuid = &uuid;
564 }
565 if( uuid_is_shunned(blob_str(pUuid)) ){
566 blob_reset(&uuid);
 
 
 
 
 
 
 
 
 
 
 
 
 
567 return;
568 }
569 if( (pXfer->maxTime != -1 && time(NULL) >= pXfer->maxTime) ||
570 pXfer->mxSend<=blob_size(pXfer->pOut) ){
571 const char *zFormat = isPriv ? "igot %b 1\n" : "igot %b\n";
572

Keyboard Shortcuts

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