Fossil SCM

For clone and sync, report the correct network traffic totals even if those totals exceed 2 GiB.

drh 2010-12-20 02:14 trunk
Commit a9e05e23e9f085b35b1b0bc9350d6121b01fb53c
2 files changed +3 -3 +2 -2
--- src/http_transport.c
+++ src/http_transport.c
@@ -30,12 +30,12 @@
3030
int isOpen; /* True when the transport layer is open */
3131
char *pBuf; /* Buffer used to hold the reply */
3232
int nAlloc; /* Space allocated for transportBuf[] */
3333
int nUsed ; /* Space of transportBuf[] used */
3434
int iCursor; /* Next unread by in transportBuf[] */
35
- int nSent; /* Number of bytes sent */
36
- int nRcvd; /* Number of bytes received */
35
+ i64 nSent; /* Number of bytes sent */
36
+ i64 nRcvd; /* Number of bytes received */
3737
FILE *pFile; /* File I/O for FILE: */
3838
char *zOutFile; /* Name of outbound file for FILE: */
3939
char *zInFile; /* Name of inbound file for FILE: */
4040
} transport = {
4141
0, 0, 0, 0, 0, 0, 0
@@ -64,11 +64,11 @@
6464
6565
/*
6666
** Retrieve send/receive counts from the transport layer. If "resetFlag"
6767
** is true, then reset the counts.
6868
*/
69
-void transport_stats(int *pnSent, int *pnRcvd, int resetFlag){
69
+void transport_stats(i64 *pnSent, i64 *pnRcvd, int resetFlag){
7070
if( pnSent ) *pnSent = transport.nSent;
7171
if( pnRcvd ) *pnRcvd = transport.nRcvd;
7272
if( resetFlag ){
7373
transport.nSent = 0;
7474
transport.nRcvd = 0;
7575
--- src/http_transport.c
+++ src/http_transport.c
@@ -30,12 +30,12 @@
30 int isOpen; /* True when the transport layer is open */
31 char *pBuf; /* Buffer used to hold the reply */
32 int nAlloc; /* Space allocated for transportBuf[] */
33 int nUsed ; /* Space of transportBuf[] used */
34 int iCursor; /* Next unread by in transportBuf[] */
35 int nSent; /* Number of bytes sent */
36 int nRcvd; /* Number of bytes received */
37 FILE *pFile; /* File I/O for FILE: */
38 char *zOutFile; /* Name of outbound file for FILE: */
39 char *zInFile; /* Name of inbound file for FILE: */
40 } transport = {
41 0, 0, 0, 0, 0, 0, 0
@@ -64,11 +64,11 @@
64
65 /*
66 ** Retrieve send/receive counts from the transport layer. If "resetFlag"
67 ** is true, then reset the counts.
68 */
69 void transport_stats(int *pnSent, int *pnRcvd, int resetFlag){
70 if( pnSent ) *pnSent = transport.nSent;
71 if( pnRcvd ) *pnRcvd = transport.nRcvd;
72 if( resetFlag ){
73 transport.nSent = 0;
74 transport.nRcvd = 0;
75
--- src/http_transport.c
+++ src/http_transport.c
@@ -30,12 +30,12 @@
30 int isOpen; /* True when the transport layer is open */
31 char *pBuf; /* Buffer used to hold the reply */
32 int nAlloc; /* Space allocated for transportBuf[] */
33 int nUsed ; /* Space of transportBuf[] used */
34 int iCursor; /* Next unread by in transportBuf[] */
35 i64 nSent; /* Number of bytes sent */
36 i64 nRcvd; /* Number of bytes received */
37 FILE *pFile; /* File I/O for FILE: */
38 char *zOutFile; /* Name of outbound file for FILE: */
39 char *zInFile; /* Name of inbound file for FILE: */
40 } transport = {
41 0, 0, 0, 0, 0, 0, 0
@@ -64,11 +64,11 @@
64
65 /*
66 ** Retrieve send/receive counts from the transport layer. If "resetFlag"
67 ** is true, then reset the counts.
68 */
69 void transport_stats(i64 *pnSent, i64 *pnRcvd, int resetFlag){
70 if( pnSent ) *pnSent = transport.nSent;
71 if( pnRcvd ) *pnRcvd = transport.nRcvd;
72 if( resetFlag ){
73 transport.nSent = 0;
74 transport.nRcvd = 0;
75
+2 -2
--- src/xfer.c
+++ src/xfer.c
@@ -1124,11 +1124,11 @@
11241124
int nFileSend = 0;
11251125
int origConfigRcvMask; /* Original value of configRcvMask */
11261126
int nFileRecv; /* Number of files received */
11271127
int mxPhantomReq = 200; /* Max number of phantoms to request per comm */
11281128
const char *zCookie; /* Server cookie */
1129
- int nSent, nRcvd; /* Bytes sent and received (after compression) */
1129
+ i64 nSent, nRcvd; /* Bytes sent and received (after compression) */
11301130
int cloneSeqno = 1; /* Sequence number for clones */
11311131
Blob send; /* Text we are sending to the server */
11321132
Blob recv; /* Reply we got back from the server */
11331133
Xfer xfer; /* Transfer data */
11341134
int pctDone; /* Percentage done with a message */
@@ -1566,15 +1566,15 @@
15661566
15671567
/* Stop the cycle if the server sends a "clone_seqno 0" card */
15681568
if( cloneSeqno<=0 ) go = 0;
15691569
};
15701570
transport_stats(&nSent, &nRcvd, 1);
1571
- fossil_print("Total network traffic: %d bytes sent, %d bytes received\n",
1571
+ fossil_print("Total network traffic: %lld bytes sent, %lld bytes received\n",
15721572
nSent, nRcvd);
15731573
transport_close();
15741574
transport_global_shutdown();
15751575
db_multi_exec("DROP TABLE onremote");
15761576
manifest_crosslink_end();
15771577
content_enable_dephantomize(1);
15781578
db_end_transaction(0);
15791579
return nErr;
15801580
}
15811581
--- src/xfer.c
+++ src/xfer.c
@@ -1124,11 +1124,11 @@
1124 int nFileSend = 0;
1125 int origConfigRcvMask; /* Original value of configRcvMask */
1126 int nFileRecv; /* Number of files received */
1127 int mxPhantomReq = 200; /* Max number of phantoms to request per comm */
1128 const char *zCookie; /* Server cookie */
1129 int nSent, nRcvd; /* Bytes sent and received (after compression) */
1130 int cloneSeqno = 1; /* Sequence number for clones */
1131 Blob send; /* Text we are sending to the server */
1132 Blob recv; /* Reply we got back from the server */
1133 Xfer xfer; /* Transfer data */
1134 int pctDone; /* Percentage done with a message */
@@ -1566,15 +1566,15 @@
1566
1567 /* Stop the cycle if the server sends a "clone_seqno 0" card */
1568 if( cloneSeqno<=0 ) go = 0;
1569 };
1570 transport_stats(&nSent, &nRcvd, 1);
1571 fossil_print("Total network traffic: %d bytes sent, %d bytes received\n",
1572 nSent, nRcvd);
1573 transport_close();
1574 transport_global_shutdown();
1575 db_multi_exec("DROP TABLE onremote");
1576 manifest_crosslink_end();
1577 content_enable_dephantomize(1);
1578 db_end_transaction(0);
1579 return nErr;
1580 }
1581
--- src/xfer.c
+++ src/xfer.c
@@ -1124,11 +1124,11 @@
1124 int nFileSend = 0;
1125 int origConfigRcvMask; /* Original value of configRcvMask */
1126 int nFileRecv; /* Number of files received */
1127 int mxPhantomReq = 200; /* Max number of phantoms to request per comm */
1128 const char *zCookie; /* Server cookie */
1129 i64 nSent, nRcvd; /* Bytes sent and received (after compression) */
1130 int cloneSeqno = 1; /* Sequence number for clones */
1131 Blob send; /* Text we are sending to the server */
1132 Blob recv; /* Reply we got back from the server */
1133 Xfer xfer; /* Transfer data */
1134 int pctDone; /* Percentage done with a message */
@@ -1566,15 +1566,15 @@
1566
1567 /* Stop the cycle if the server sends a "clone_seqno 0" card */
1568 if( cloneSeqno<=0 ) go = 0;
1569 };
1570 transport_stats(&nSent, &nRcvd, 1);
1571 fossil_print("Total network traffic: %lld bytes sent, %lld bytes received\n",
1572 nSent, nRcvd);
1573 transport_close();
1574 transport_global_shutdown();
1575 db_multi_exec("DROP TABLE onremote");
1576 manifest_crosslink_end();
1577 content_enable_dephantomize(1);
1578 db_end_transaction(0);
1579 return nErr;
1580 }
1581

Keyboard Shortcuts

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