Overview
SHA1 Hash: | 0c102d06c3ba37128c3965acb718e086e7d462ff |
---|---|
Date: | 2007-08-01 10:27:08 |
User: | drh |
Comment: | Fixes to the sync algorithm. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/xfer.c from [28318ca22c] to [104eca26b1].
@@ -445,10 +445,24 @@ db_finalize(&q); } 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); } /* ** COMMAND: test-xfer @@ -498,10 +512,11 @@ const char *zSCode = db_get("server-code", "x"); 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 */ Blob errmsg; /* Error message */ @@ -578,10 +593,11 @@ } /* 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); /* Process the reply that came back from the server */ @@ -688,14 +704,15 @@ blobarray_reset(aToken, nToken); } 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); db_multi_exec( "DROP TABLE onremote;" "DROP TABLE pending;" ); }