Diff
Not logged in

Differences From:

File src/xfer.c part of check-in [71ed18cc4b] - Do not attempt to verify phantoms. Set the default max message size at 500K instead of 1MB. Updates to the todo list. by drh on 2007-08-01 02:03:31. [view]

To:

File src/xfer.c part of check-in [0c102d06c3] - Fixes to the sync algorithm. by drh on 2007-08-01 10:27:08. [view]

@@ -446,8 +446,22 @@
   }
   if( isPull ){
     send_all_pending(0);
   }
+  if( isPush || isPull ){
+    /* Always send our leaves */
+    Stmt q;
+    db_prepare(&q,
+       "SELECT uuid FROM blob WHERE rid IN"
+       "  (SELECT cid FROM plink EXCEPT SELECT pid FROM plink)"
+    );
+    while( db_step(&q)==SQLITE_ROW ){
+      const char *zUuid = db_column_text(&q, 0);
+      @ leaf %s(zUuid)
+    }
+    db_finalize(&q);
+  }
+
   db_end_transaction(0);
 }
 
 /*
@@ -499,8 +513,9 @@
   const char *zPCode = db_get("project-code", 0);
   int nFile = 0;
   int nMsg = 0;
   int nReq = 0;
+  int nFileSend;
   Blob send;        /* Text we are sending to the server */
   Blob recv;        /* Reply we got back from the server */
   Blob line;        /* A single line of the reply */
   Blob aToken[5];   /* A tokenization of line */
@@ -579,8 +594,9 @@
 
     /* Exchange messages with the server */
     printf("Send:      %d files, %d requests, %d other messages\n",
             nFile, nReq, nMsg);
+    nFileSend = nFile;
     nFile = nReq = nMsg = 0;
     http_exchange(&send, &recv);
     blob_reset(&send);
 
@@ -689,8 +705,9 @@
     }
     blob_reset(&recv);
     printf("Received:  %d files, %d requests, %d other messages\n",
             nFile, nReq, nMsg);
+    if( nFileSend + nFile==0 ){ go = 0; }
     nFile = nReq = nMsg = 0;
   };
   http_close();
   db_end_transaction(0);