@@ -1750,16 +1750,16 @@ private static void CircuitWatchLoop()
17501750
17511751 ClearProgressLine ( ) ;
17521752 int closed = 0 ;
1753- int weakN = 0 , stuckN = 0 ;
1753+ int closedWeak = 0 , closedStuck = 0 ;
17541754 string closedIds = "" ;
17551755 foreach ( string [ ] leg in toRemove )
17561756 {
17571757 string reason ;
17581758 toRemoveReasons . TryGetValue ( leg [ 0 ] , out reason ) ;
1759- if ( reason == "weak" ) weakN ++ ; else stuckN ++ ;
17601759 if ( ControlSend ( "CLOSECIRCUIT " + leg [ 0 ] ) )
17611760 {
17621761 closed ++ ;
1762+ if ( reason == "weak" ) closedWeak ++ ; else closedStuck ++ ;
17631763 weakStrikes . Remove ( leg [ 0 ] ) ;
17641764 if ( closedIds . Length > 0 ) closedIds += ", " ;
17651765 closedIds += leg [ 0 ] ;
@@ -1769,11 +1769,35 @@ private static void CircuitWatchLoop()
17691769 {
17701770 lastClose = DateTime . UtcNow ;
17711771 string what = "" ;
1772- if ( weakN > 0 ) what = weakN + " weak" ;
1773- if ( stuckN > 0 )
1774- what = ( what . Length > 0 ? what + ", " : "" ) + stuckN + " stuck-unlinked" ;
1772+ if ( closedWeak > 0 ) what = closedWeak + " weak" ;
1773+ if ( closedStuck > 0 )
1774+ what = ( what . Length > 0 ? what + ", " : "" ) + closedStuck + " stuck-unlinked" ;
17751775 Log ( "monitor: closed " + what + " leg(s) (" + closedIds +
17761776 ") - replacement building" ) ;
1777+ int cSets = 0 , cLegs = 0 , cLinked = 0 ;
1778+ var now = ConfluxQuery ( ) ;
1779+ if ( now != null )
1780+ {
1781+ var setIds = new HashSet < string > ( ) ;
1782+ foreach ( string [ ] leg in now )
1783+ {
1784+ setIds . Add ( leg [ 0 ] ) ;
1785+ if ( leg [ 4 ] . Equals ( "LINKED" , StringComparison . OrdinalIgnoreCase ) ) cLinked ++ ;
1786+ }
1787+ cSets = setIds . Count ;
1788+ cLegs = now . Count ;
1789+ }
1790+ lock ( consoleLock )
1791+ {
1792+ Console . WriteLine ( ) ;
1793+ Console . WriteLine ( Stamp ( ) + "leg cleanup report:" ) ;
1794+ Console . WriteLine ( " closed : " + closed + " (" + what + ")" ) ;
1795+ Console . WriteLine ( " circuits : " + closedIds ) ;
1796+ Console . WriteLine ( " conflux : " + cSets + " set(s), " + cLegs +
1797+ " leg(s), " + cLinked + " linked" ) ;
1798+ Console . WriteLine ( " next scan : every " + watchIntervalS + " s; next close " +
1799+ "no earlier than " + watchCooldownS + " s from now" ) ;
1800+ }
17771801 }
17781802 }
17791803 }
0 commit comments