Diff
Not logged in

Differences From:

File src/xfer.c part of check-in [134e2aeccc] - Combine the "config" and "setting" commands into a single "settings" command. by drh on 2007-09-28 20:08:32. [view]

To:

File src/xfer.c part of check-in [70d5cc86b7] - Add the shun table. Do not process artifacts named in the shun table. by drh on 2007-10-05 13:47:00. [view]

@@ -107,8 +107,12 @@
   }
   blob_zero(&content);
   blob_zero(&hash);
   blob_extract(pXfer->pIn, n, &content);
+  if( db_exists("SELECT 1 FROM shun WHERE uuid=%B", &pXfer->aToken[1]) ){
+    /* Ignore files that have been shunned */
+    return;
+  }
   if( pXfer->nToken==4 ){
     Blob src;
     int srcid = rid_from_uuid(&pXfer->aToken[2], 1);
     if( content_get(srcid, &src)==0 ){
@@ -239,9 +243,12 @@
 ** Send a gimme message for every phantom.
 */
 static void request_phantoms(Xfer *pXfer){
   Stmt q;
-  db_prepare(&q, "SELECT uuid FROM phantom JOIN blob USING(rid)");
+  db_prepare(&q,
+    "SELECT uuid FROM phantom JOIN blob USING(rid)"
+    " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
+  );
   while( db_step(&q)==SQLITE_ROW ){
     const char *zUuid = db_column_text(&q, 0);
     blob_appendf(pXfer->pOut, "gimme %s\n", zUuid);
     pXfer->nGimmeSent++;
@@ -376,9 +383,12 @@
 */
 static int send_unclustered(Xfer *pXfer){
   Stmt q;
   int cnt = 0;
-  db_prepare(&q, "SELECT uuid FROM unclustered JOIN blob USING(rid)");
+  db_prepare(&q,
+    "SELECT uuid FROM unclustered JOIN blob USING(rid)"
+    " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)"
+  );
   while( db_step(&q)==SQLITE_ROW ){
     blob_appendf(pXfer->pOut, "igot %s\n", db_column_text(&q, 0));
     cnt++;
   }