Diff
Not logged in

Differences From:

File src/xfer.c part of check-in [7646ee13e3] - Fix an issue with "clone" on the client side: the client was requesting multiple copies of artifacts for which it held a delta with a phantom source. by drh on 2009-08-12 14:27:24. [view]

To:

File src/xfer.c part of check-in [79be9028eb] - Keep track of total network traffic for a sync and report the totals at the end of the sync. by drh on 2009-08-12 14:41:32. [view]

@@ -863,14 +863,16 @@
   int origConfigRcvMask;  /* Original value of configRcvMask */
   int nFileRecv;          /* Number of files received */
   int mxPhantomReq = 200; /* Max number of phantoms to request per comm */
   const char *zCookie;    /* Server cookie */
+  int nSent, nRcvd;       /* Bytes sent and received (after compression) */
   Blob send;              /* Text we are sending to the server */
   Blob recv;              /* Reply we got back from the server */
   Xfer xfer;              /* Transfer data */
   const char *zSCode = db_get("server-code", "x");
   const char *zPCode = db_get("project-code", 0);
 
+  transport_stats(0, 0, 1);
   socket_global_init();
   memset(&xfer, 0, sizeof(xfer));
   xfer.pIn = &recv;
   xfer.pOut = &send;
@@ -958,13 +960,11 @@
       configSendMask = 0;
     }
 
     /* Append randomness to the end of the message */
-#if 1   /* Enable this after all servers have upgraded */
     zRandomness = db_text(0, "SELECT hex(randomblob(20))");
     blob_appendf(&send, "# %s\n", zRandomness);
     free(zRandomness);
-#endif
 
     /* Exchange messages with the server */
     nFileSend = xfer.nFileSent + xfer.nDeltaSent;
     printf(zValueFormat, "Send:",
@@ -1181,9 +1181,12 @@
     if( xfer.nFileSent+xfer.nDeltaSent>0 ){
       go = 1;
     }
   };
+  transport_stats(&nSent, &nRcvd, 1);
+  printf("Total network traffic: %d bytes sent, %d bytes received\n",
+         nSent, nRcvd);
   transport_close();
   socket_global_shutdown();
   db_multi_exec("DROP TABLE onremote");
   db_end_transaction(0);
 }