Fossil SCM
Add warnings to clients which receive content that creates a fork. Defer warnings as much as possible.
Commit
9d45319345b5fa7615a318d7bd7fb3c97a705876
Parent
6b410f914ef5be5…
1 file changed
+17
-2
+17
-2
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -930,10 +930,11 @@ | ||
| 930 | 930 | */ |
| 931 | 931 | void page_xfer(void){ |
| 932 | 932 | int isPull = 0; |
| 933 | 933 | int isPush = 0; |
| 934 | 934 | int nErr = 0; |
| 935 | + int fForkSeen = 0; /* True if fork was seen while receiving content */ | |
| 935 | 936 | Xfer xfer; |
| 936 | 937 | int deltaFlag = 0; |
| 937 | 938 | int isClone = 0; |
| 938 | 939 | int nGimme = 0; |
| 939 | 940 | int size; |
| @@ -1003,11 +1004,11 @@ | ||
| 1003 | 1004 | nErr++; |
| 1004 | 1005 | break; |
| 1005 | 1006 | } |
| 1006 | 1007 | xfer_accept_file(&xfer, 0, pzUuidList, pnUuidList); |
| 1007 | 1008 | if( xfer.fHasFork ){ |
| 1008 | - @ message ******\sWARNING:\sa\sfork\shas\soccurred\s****** | |
| 1009 | + fForkSeen = 1; | |
| 1009 | 1010 | } |
| 1010 | 1011 | if( blob_size(&xfer.err) ){ |
| 1011 | 1012 | cgi_reset_content(); |
| 1012 | 1013 | @ error %T(blob_str(&xfer.err)) |
| 1013 | 1014 | nErr++; |
| @@ -1027,11 +1028,11 @@ | ||
| 1027 | 1028 | nErr++; |
| 1028 | 1029 | break; |
| 1029 | 1030 | } |
| 1030 | 1031 | xfer_accept_compressed_file(&xfer, pzUuidList, pnUuidList); |
| 1031 | 1032 | if( xfer.fHasFork ){ |
| 1032 | - @ message ******\sWARNING:\sa\sfork\shas\soccurred\s****** | |
| 1033 | + fForkSeen = 1; | |
| 1033 | 1034 | } |
| 1034 | 1035 | if( blob_size(&xfer.err) ){ |
| 1035 | 1036 | cgi_reset_content(); |
| 1036 | 1037 | @ error %T(blob_str(&xfer.err)) |
| 1037 | 1038 | nErr++; |
| @@ -1311,10 +1312,13 @@ | ||
| 1311 | 1312 | @ error bad\scommand:\s%F(blob_str(&xfer.line)) |
| 1312 | 1313 | } |
| 1313 | 1314 | blobarray_reset(xfer.aToken, xfer.nToken); |
| 1314 | 1315 | blob_reset(&xfer.line); |
| 1315 | 1316 | } |
| 1317 | + if( fForkSeen ){ | |
| 1318 | + @ message *****\s\sWARNING:\sa\sfork\shas\soccurred\s\s***** | |
| 1319 | + } | |
| 1316 | 1320 | if( isPush ){ |
| 1317 | 1321 | if( rc==TH_OK ){ |
| 1318 | 1322 | rc = xfer_run_script(zScript, zUuidList, 1); |
| 1319 | 1323 | if( rc==TH_ERROR ){ |
| 1320 | 1324 | cgi_reset_content(); |
| @@ -1449,10 +1453,11 @@ | ||
| 1449 | 1453 | int lastPctDone = -1; /* Last displayed pctDone */ |
| 1450 | 1454 | double rArrivalTime; /* Time at which a message arrived */ |
| 1451 | 1455 | const char *zSCode = db_get("server-code", "x"); |
| 1452 | 1456 | const char *zPCode = db_get("project-code", 0); |
| 1453 | 1457 | int nErr = 0; /* Number of errors */ |
| 1458 | + int fForkSeen = 0; /* True if a fork was seen during pull */ | |
| 1454 | 1459 | int nRoundtrip= 0; /* Number of HTTP requests */ |
| 1455 | 1460 | int nArtifactSent = 0; /* Total artifacts sent */ |
| 1456 | 1461 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1457 | 1462 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1458 | 1463 | double rSkew = 0.0; /* Maximum time skew */ |
| @@ -1664,10 +1669,11 @@ | ||
| 1664 | 1669 | } |
| 1665 | 1670 | nCardRcvd++; |
| 1666 | 1671 | continue; |
| 1667 | 1672 | } |
| 1668 | 1673 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1674 | + xfer.fHasFork = 0; | |
| 1669 | 1675 | nCardRcvd++; |
| 1670 | 1676 | if( (syncFlags & SYNC_VERBOSE)!=0 && recv.nUsed>0 ){ |
| 1671 | 1677 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1672 | 1678 | if( pctDone!=lastPctDone ){ |
| 1673 | 1679 | fossil_print("\rprocessed: %d%% ", pctDone); |
| @@ -1681,10 +1687,13 @@ | ||
| 1681 | 1687 | ** |
| 1682 | 1688 | ** Receive a file transmitted from the server. |
| 1683 | 1689 | */ |
| 1684 | 1690 | if( blob_eq(&xfer.aToken[0],"file") ){ |
| 1685 | 1691 | xfer_accept_file(&xfer, (syncFlags & SYNC_CLONE)!=0, 0, 0); |
| 1692 | + if( (syncFlags & SYNC_PULL) && xfer.fHasFork ){ | |
| 1693 | + fForkSeen = 1; | |
| 1694 | + } | |
| 1686 | 1695 | nArtifactRcvd++; |
| 1687 | 1696 | }else |
| 1688 | 1697 | |
| 1689 | 1698 | /* cfile UUID USIZE CSIZE \n CONTENT |
| 1690 | 1699 | ** cfile UUID DELTASRC USIZE CSIZE \n CONTENT |
| @@ -1691,10 +1700,13 @@ | ||
| 1691 | 1700 | ** |
| 1692 | 1701 | ** Receive a compressed file transmitted from the server. |
| 1693 | 1702 | */ |
| 1694 | 1703 | if( blob_eq(&xfer.aToken[0],"cfile") ){ |
| 1695 | 1704 | xfer_accept_compressed_file(&xfer, 0, 0); |
| 1705 | + if( (syncFlags & SYNC_PULL) && xfer.fHasFork ){ | |
| 1706 | + fForkSeen = 1; | |
| 1707 | + } | |
| 1696 | 1708 | nArtifactRcvd++; |
| 1697 | 1709 | }else |
| 1698 | 1710 | |
| 1699 | 1711 | /* gimme UUID |
| 1700 | 1712 | ** |
| @@ -1963,10 +1975,13 @@ | ||
| 1963 | 1975 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1964 | 1976 | content_enable_dephantomize(1); |
| 1965 | 1977 | } |
| 1966 | 1978 | db_end_transaction(0); |
| 1967 | 1979 | }; |
| 1980 | + if( fForkSeen ){ | |
| 1981 | + fossil_warning("***** WARNING: a fork has occurred *****"); | |
| 1982 | + } | |
| 1968 | 1983 | transport_stats(&nSent, &nRcvd, 1); |
| 1969 | 1984 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1970 | 1985 | fossil_warning("*** time skew *** server is fast by %s", |
| 1971 | 1986 | db_timespan_name(rSkew)); |
| 1972 | 1987 | g.clockSkewSeen = 1; |
| 1973 | 1988 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -930,10 +930,11 @@ | |
| 930 | */ |
| 931 | void page_xfer(void){ |
| 932 | int isPull = 0; |
| 933 | int isPush = 0; |
| 934 | int nErr = 0; |
| 935 | Xfer xfer; |
| 936 | int deltaFlag = 0; |
| 937 | int isClone = 0; |
| 938 | int nGimme = 0; |
| 939 | int size; |
| @@ -1003,11 +1004,11 @@ | |
| 1003 | nErr++; |
| 1004 | break; |
| 1005 | } |
| 1006 | xfer_accept_file(&xfer, 0, pzUuidList, pnUuidList); |
| 1007 | if( xfer.fHasFork ){ |
| 1008 | @ message ******\sWARNING:\sa\sfork\shas\soccurred\s****** |
| 1009 | } |
| 1010 | if( blob_size(&xfer.err) ){ |
| 1011 | cgi_reset_content(); |
| 1012 | @ error %T(blob_str(&xfer.err)) |
| 1013 | nErr++; |
| @@ -1027,11 +1028,11 @@ | |
| 1027 | nErr++; |
| 1028 | break; |
| 1029 | } |
| 1030 | xfer_accept_compressed_file(&xfer, pzUuidList, pnUuidList); |
| 1031 | if( xfer.fHasFork ){ |
| 1032 | @ message ******\sWARNING:\sa\sfork\shas\soccurred\s****** |
| 1033 | } |
| 1034 | if( blob_size(&xfer.err) ){ |
| 1035 | cgi_reset_content(); |
| 1036 | @ error %T(blob_str(&xfer.err)) |
| 1037 | nErr++; |
| @@ -1311,10 +1312,13 @@ | |
| 1311 | @ error bad\scommand:\s%F(blob_str(&xfer.line)) |
| 1312 | } |
| 1313 | blobarray_reset(xfer.aToken, xfer.nToken); |
| 1314 | blob_reset(&xfer.line); |
| 1315 | } |
| 1316 | if( isPush ){ |
| 1317 | if( rc==TH_OK ){ |
| 1318 | rc = xfer_run_script(zScript, zUuidList, 1); |
| 1319 | if( rc==TH_ERROR ){ |
| 1320 | cgi_reset_content(); |
| @@ -1449,10 +1453,11 @@ | |
| 1449 | int lastPctDone = -1; /* Last displayed pctDone */ |
| 1450 | double rArrivalTime; /* Time at which a message arrived */ |
| 1451 | const char *zSCode = db_get("server-code", "x"); |
| 1452 | const char *zPCode = db_get("project-code", 0); |
| 1453 | int nErr = 0; /* Number of errors */ |
| 1454 | int nRoundtrip= 0; /* Number of HTTP requests */ |
| 1455 | int nArtifactSent = 0; /* Total artifacts sent */ |
| 1456 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1457 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1458 | double rSkew = 0.0; /* Maximum time skew */ |
| @@ -1664,10 +1669,11 @@ | |
| 1664 | } |
| 1665 | nCardRcvd++; |
| 1666 | continue; |
| 1667 | } |
| 1668 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1669 | nCardRcvd++; |
| 1670 | if( (syncFlags & SYNC_VERBOSE)!=0 && recv.nUsed>0 ){ |
| 1671 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1672 | if( pctDone!=lastPctDone ){ |
| 1673 | fossil_print("\rprocessed: %d%% ", pctDone); |
| @@ -1681,10 +1687,13 @@ | |
| 1681 | ** |
| 1682 | ** Receive a file transmitted from the server. |
| 1683 | */ |
| 1684 | if( blob_eq(&xfer.aToken[0],"file") ){ |
| 1685 | xfer_accept_file(&xfer, (syncFlags & SYNC_CLONE)!=0, 0, 0); |
| 1686 | nArtifactRcvd++; |
| 1687 | }else |
| 1688 | |
| 1689 | /* cfile UUID USIZE CSIZE \n CONTENT |
| 1690 | ** cfile UUID DELTASRC USIZE CSIZE \n CONTENT |
| @@ -1691,10 +1700,13 @@ | |
| 1691 | ** |
| 1692 | ** Receive a compressed file transmitted from the server. |
| 1693 | */ |
| 1694 | if( blob_eq(&xfer.aToken[0],"cfile") ){ |
| 1695 | xfer_accept_compressed_file(&xfer, 0, 0); |
| 1696 | nArtifactRcvd++; |
| 1697 | }else |
| 1698 | |
| 1699 | /* gimme UUID |
| 1700 | ** |
| @@ -1963,10 +1975,13 @@ | |
| 1963 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1964 | content_enable_dephantomize(1); |
| 1965 | } |
| 1966 | db_end_transaction(0); |
| 1967 | }; |
| 1968 | transport_stats(&nSent, &nRcvd, 1); |
| 1969 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1970 | fossil_warning("*** time skew *** server is fast by %s", |
| 1971 | db_timespan_name(rSkew)); |
| 1972 | g.clockSkewSeen = 1; |
| 1973 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -930,10 +930,11 @@ | |
| 930 | */ |
| 931 | void page_xfer(void){ |
| 932 | int isPull = 0; |
| 933 | int isPush = 0; |
| 934 | int nErr = 0; |
| 935 | int fForkSeen = 0; /* True if fork was seen while receiving content */ |
| 936 | Xfer xfer; |
| 937 | int deltaFlag = 0; |
| 938 | int isClone = 0; |
| 939 | int nGimme = 0; |
| 940 | int size; |
| @@ -1003,11 +1004,11 @@ | |
| 1004 | nErr++; |
| 1005 | break; |
| 1006 | } |
| 1007 | xfer_accept_file(&xfer, 0, pzUuidList, pnUuidList); |
| 1008 | if( xfer.fHasFork ){ |
| 1009 | fForkSeen = 1; |
| 1010 | } |
| 1011 | if( blob_size(&xfer.err) ){ |
| 1012 | cgi_reset_content(); |
| 1013 | @ error %T(blob_str(&xfer.err)) |
| 1014 | nErr++; |
| @@ -1027,11 +1028,11 @@ | |
| 1028 | nErr++; |
| 1029 | break; |
| 1030 | } |
| 1031 | xfer_accept_compressed_file(&xfer, pzUuidList, pnUuidList); |
| 1032 | if( xfer.fHasFork ){ |
| 1033 | fForkSeen = 1; |
| 1034 | } |
| 1035 | if( blob_size(&xfer.err) ){ |
| 1036 | cgi_reset_content(); |
| 1037 | @ error %T(blob_str(&xfer.err)) |
| 1038 | nErr++; |
| @@ -1311,10 +1312,13 @@ | |
| 1312 | @ error bad\scommand:\s%F(blob_str(&xfer.line)) |
| 1313 | } |
| 1314 | blobarray_reset(xfer.aToken, xfer.nToken); |
| 1315 | blob_reset(&xfer.line); |
| 1316 | } |
| 1317 | if( fForkSeen ){ |
| 1318 | @ message *****\s\sWARNING:\sa\sfork\shas\soccurred\s\s***** |
| 1319 | } |
| 1320 | if( isPush ){ |
| 1321 | if( rc==TH_OK ){ |
| 1322 | rc = xfer_run_script(zScript, zUuidList, 1); |
| 1323 | if( rc==TH_ERROR ){ |
| 1324 | cgi_reset_content(); |
| @@ -1449,10 +1453,11 @@ | |
| 1453 | int lastPctDone = -1; /* Last displayed pctDone */ |
| 1454 | double rArrivalTime; /* Time at which a message arrived */ |
| 1455 | const char *zSCode = db_get("server-code", "x"); |
| 1456 | const char *zPCode = db_get("project-code", 0); |
| 1457 | int nErr = 0; /* Number of errors */ |
| 1458 | int fForkSeen = 0; /* True if a fork was seen during pull */ |
| 1459 | int nRoundtrip= 0; /* Number of HTTP requests */ |
| 1460 | int nArtifactSent = 0; /* Total artifacts sent */ |
| 1461 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1462 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1463 | double rSkew = 0.0; /* Maximum time skew */ |
| @@ -1664,10 +1669,11 @@ | |
| 1669 | } |
| 1670 | nCardRcvd++; |
| 1671 | continue; |
| 1672 | } |
| 1673 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| 1674 | xfer.fHasFork = 0; |
| 1675 | nCardRcvd++; |
| 1676 | if( (syncFlags & SYNC_VERBOSE)!=0 && recv.nUsed>0 ){ |
| 1677 | pctDone = (recv.iCursor*100)/recv.nUsed; |
| 1678 | if( pctDone!=lastPctDone ){ |
| 1679 | fossil_print("\rprocessed: %d%% ", pctDone); |
| @@ -1681,10 +1687,13 @@ | |
| 1687 | ** |
| 1688 | ** Receive a file transmitted from the server. |
| 1689 | */ |
| 1690 | if( blob_eq(&xfer.aToken[0],"file") ){ |
| 1691 | xfer_accept_file(&xfer, (syncFlags & SYNC_CLONE)!=0, 0, 0); |
| 1692 | if( (syncFlags & SYNC_PULL) && xfer.fHasFork ){ |
| 1693 | fForkSeen = 1; |
| 1694 | } |
| 1695 | nArtifactRcvd++; |
| 1696 | }else |
| 1697 | |
| 1698 | /* cfile UUID USIZE CSIZE \n CONTENT |
| 1699 | ** cfile UUID DELTASRC USIZE CSIZE \n CONTENT |
| @@ -1691,10 +1700,13 @@ | |
| 1700 | ** |
| 1701 | ** Receive a compressed file transmitted from the server. |
| 1702 | */ |
| 1703 | if( blob_eq(&xfer.aToken[0],"cfile") ){ |
| 1704 | xfer_accept_compressed_file(&xfer, 0, 0); |
| 1705 | if( (syncFlags & SYNC_PULL) && xfer.fHasFork ){ |
| 1706 | fForkSeen = 1; |
| 1707 | } |
| 1708 | nArtifactRcvd++; |
| 1709 | }else |
| 1710 | |
| 1711 | /* gimme UUID |
| 1712 | ** |
| @@ -1963,10 +1975,13 @@ | |
| 1975 | manifest_crosslink_end(MC_PERMIT_HOOKS); |
| 1976 | content_enable_dephantomize(1); |
| 1977 | } |
| 1978 | db_end_transaction(0); |
| 1979 | }; |
| 1980 | if( fForkSeen ){ |
| 1981 | fossil_warning("***** WARNING: a fork has occurred *****"); |
| 1982 | } |
| 1983 | transport_stats(&nSent, &nRcvd, 1); |
| 1984 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1985 | fossil_warning("*** time skew *** server is fast by %s", |
| 1986 | db_timespan_name(rSkew)); |
| 1987 | g.clockSkewSeen = 1; |
| 1988 |