Skip to content

Commit 09b7b3b

Browse files
author
Delta-Kronecker
committed
launcher: print a leg cleanup report to the console after each close pass
1 parent 52f1586 commit 09b7b3b

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ quality legs so tor rebuilds them with fresh circuits:
202202
tor launches a replacement leg for every closed leg (sets below the configured
203203
`ConfluxNumLegs` target are also topped up with `CONFLUX ADD`), and conflux
204204
migrates streams onto the fresh circuits. A 20 s cooldown between closes keeps
205-
the circuit set stable (relaxed during tunnel warmup). Disable it with
205+
the circuit set stable (relaxed during tunnel warmup). After every close pass a
206+
summary report is printed to the console (legs closed, circuit ids, and the
207+
current conflux set/leg/linked counts). Disable it with
206208
`--no-circuit-watch`; tune it with `--watch-rtt <ms>`, `--watch-interval
207209
<seconds>`, `--watch-cooldown <seconds>` and the other `--watch-*` flags.
208210

scripts/start-tor.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)