diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 09:36:22 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 11:35:33 -0300 |
| commit | efbb9bb38b800deb47e581fd7b0a7ea06d504122 (patch) | |
| tree | c06a0b742b1ce6b788b9baeddc7b6f008d4604ce /test/delay_relay.py | |
| parent | 6ba1f5be0a838d1fda81425300ed5aca90b1f1ab (diff) | |
| download | pardes-efbb9bb38b800deb47e581fd7b0a7ea06d504122.tar.gz pardes-efbb9bb38b800deb47e581fd7b0a7ea06d504122.zip | |
attachClient: a far attach dials the forwarded socket until a connect answers, within the same 30 s, not only until its file is there: ssh binds the socket (its file) a moment before it listens, and a client that dialled between the two was told 'nothing answers at .../pardes-ssh-N.sock' (4 of 40 attaches through test/daemon.py's stand-in ssh at a load of 38-45; 10 of 10 with 0.5 s between its bind and listen); the probe is cloud9's connectFd, closed at once, then the client dials as before: 0 of 40 and 0 of 20 refused-name attaches with the 0.5 s; test/delay_relay.py --bound MS holds a socket bound that long before listening, and daemon.py --far's ssh uses 500; after, pinned to one CPU: 0 of 40, and 0 of 20 with the 0.5 s; the five together: tui core-test 859/1014, shell-test 1055/1058, pane-test 183/184, term-test 17/17, kitty-test 45/45, behaviour-test 275/275 and --replay, process-test 0 of 144 (cmdexit once, again alone), daemon.py in every mode, both soaks diverged 0 unequal 0, gui unit-test 1651/1655 (BaselineHarnessMismatch), the frame and perf gate against tree2 PASS
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/delay_relay.py')
| -rw-r--r-- | test/delay_relay.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/delay_relay.py b/test/delay_relay.py index c600a3aa..b0d48e38 100644 --- a/test/delay_relay.py +++ b/test/delay_relay.py @@ -8,7 +8,7 @@ the ones before it have crossed at that rate, then waits out the delay. An optional jitter adds up to that many ms more to each chunk's delay, at random, its order kept (a chunk never overtakes the one before it). - python3 -B test/delay_relay.py LISTEN TARGET --delay MS [--rate MB/s] [--jitter MS] + python3 -B test/delay_relay.py LISTEN TARGET --delay MS [--rate MB/s] [--jitter MS] [--bound MS] python3 -B test/delay_relay.py --self-check An address is a path (a Unix socket) or host:port (TCP). The one-way @@ -46,7 +46,9 @@ def dial(address): return s -def listen(address): +def listen(address, bound=0.0): + """Bound, then listening `bound` s later (an ssh -L's socket file is + there a moment before it answers).""" family, addr = parse(address) s = socket.socket(family) if family == socket.AF_UNIX: @@ -57,6 +59,7 @@ def listen(address): else: s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(addr) + time.sleep(bound) s.listen(64) return s @@ -260,8 +263,9 @@ def main(): ap.add_argument('--delay', type=float, required=True, help='one-way delay, ms') ap.add_argument('--rate', type=float, help='a bandwidth cap, MB/s') ap.add_argument('--jitter', type=float, default=0, help='up to this many ms more a chunk, at random') + ap.add_argument('--bound', type=float, default=0, help='ms between the bind and the listen') a = ap.parse_args() - listener = listen(a.listen) + listener = listen(a.listen, a.bound / 1000) print(f'relaying {a.listen} -> {a.target}, {a.delay} ms each way' + (f', {a.rate} MB/s' if a.rate else '') + (f', jitter {a.jitter} ms' if a.jitter else ''), flush=True) try: |
