Repository navigation
Fix Iroh control-session termination during Mac switching #12324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
ff06ed2
046860f
65044aa
8bb5534
0395ab7
0535de0
54e7357
6282cb1
b0e7f3d
5af94ad
02c2bef
17a96cb
6458b46
2669e2a
0422957
ef0dae2
2451343
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -326,6 +326,41 @@ public actor IrxPeerEngine { | |
| return nil | ||
| } | ||
|
|
||
| /// Retires one exact admitted session for a planned owner handoff. | ||
| /// | ||
| /// The caller remains responsible for closing the matching connection | ||
| /// after this method returns. Clearing the engine first prevents the | ||
| /// termination watcher or keepalive callback from scheduling an automatic | ||
| /// replacement for a connection that the client intentionally retired. | ||
|
Comment on lines
+331
to
+334
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🤖 get_repo_knowledge executed:
Length of output: 46434 🏁 Script executed: #!/bin/bash
set -eu
file='Packages/Shared/CmuxIrxTransport/Sources/CmuxIrxTransport/IrxPeerEngine.swift'
printf '%s\n' '--- target file outline ---'
ast-grep outline "$file"
printf '%s\n' '--- target implementation ---'
sed -n '240,380p' "$file"
printf '%s\n' '--- session-related references ---'
rg -n -C 4 'ensureSession|retire\(|session\b|isConnectionClosed' "$file"
printf '%s\n' '--- related tests ---'
rg -n -C 3 'ensureSession|retire\(|IrxPeerEngine|isConnectionClosed' Packages/Shared/CmuxIrxTransport Tests 2>/dev/null || trueRepository: manaflow-ai/cmux Length of output: 40410 🏁 Script executed: #!/bin/bash
set -eu
file='Packages/Shared/CmuxIrxTransport/Sources/CmuxIrxTransport/IrxPeerEngine.swift'
sed -n '240,380p' "$file"
printf '%s\n' '--- references ---'
rg -n -C 4 'ensureSession|retire\(|session\b|isConnectionClosed' "$file"
printf '%s\n' '--- tests ---'
rg -n -C 3 'ensureSession|retire\(|IrxPeerEngine|isConnectionClosed' Packages/Shared/CmuxIrxTransport Tests 2>/dev/null || trueRepository: manaflow-ai/cmux Length of output: 39748 🏁 Script executed: #!/bin/bash
set -eu
file='Packages/Shared/CmuxIrxTransport/Sources/CmuxIrxTransport/IrxPeerEngine.swift'
printf '%s\n' '--- declarations and methods ---'
rg -n '^(actor|final class|class|struct|private|internal|public| (private|internal|public)? ?(func|var|let)| func)' "$file" | sed -n '1,180p'
printf '%s\n' '--- lines 1-380 ---'
sed -n '1,380p' "$file"Repository: manaflow-ai/cmux Length of output: 18246 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- IrxConnection binding ---'
sed -n '1,45p' Packages/Shared/CmuxIrxTransport/Sources/CmuxIrxTransport/IrxConnection.swift
sed -n '145,180p' Packages/Shared/CmuxIrxTransport/Sources/CmuxIrxTransport/IrxConnection.swift
printf '%s\n' '--- retirement test context ---'
sed -n '430,490p' Packages/Shared/CmuxIrxTransport/Tests/CmuxIrxTransportTests/IrxLiveQUICTests.swift
printf '%s\n' '--- all direct IrxPeerEngine test names ---'
rg -n '(`@Test`|func test|struct .*IrxPeerEngine|retire|currentSession)' Packages/Shared/CmuxIrxTransport/Tests/CmuxIrxTransportTestsRepository: manaflow-ai/cmux Length of output: 19637 🏁 Script executed: #!/bin/bash
set -eu
rg -n -C 5 'ensureSession\(|currentSession\(' Packages/Shared/CmuxIrxTransport Packages 2>/dev/nullRepository: manaflow-ai/cmux Length of output: 36960 Revalidate the engine-owned session after
🤖 Prompt for AI AgentsSources: Coding guidelines, Path instructions |
||
| @discardableResult | ||
| public func retire( | ||
| connection: IrxConnection, | ||
| code: IrxCloseCode = .explicitRedial | ||
| ) -> Bool { | ||
| guard let current = session, current.connection === connection else { | ||
| return false | ||
| } | ||
| session = nil | ||
| terminationWatcher?.cancel() | ||
| terminationWatcher = nil | ||
| redialTimer?.cancel() | ||
| redialTimer = nil | ||
| invalidateDial() | ||
| cooldownUntil = nil | ||
| lastDialError = nil | ||
| parkedCode = nil | ||
| backoff = config.initialBackoff | ||
| record( | ||
| "session-retired", | ||
| [ | ||
| "session": current.admit.session, | ||
| "code": code.rawValue, | ||
| ] | ||
| ) | ||
| setState(.closed(code: code.rawValue)) | ||
| return true | ||
| } | ||
|
|
||
| /// Tears the session down deliberately (sign-out, mode switch). | ||
| public func stop(code: IrxCloseCode = .userRequested) async { | ||
| redialTimer?.cancel() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| import CmuxIrxTransport | ||
|
|
||
| actor IrxControlReleaseProbe { | ||
| private(set) var count = 0 | ||
| private(set) var closeCodes: [IrxCloseCode] = [] | ||
| private(set) var retiresConnections: [Bool] = [] | ||
|
|
||
| func record() { | ||
| func record(closeCode: IrxCloseCode, retiresConnection: Bool) { | ||
| count += 1 | ||
| closeCodes.append(closeCode) | ||
| retiresConnections.append(retiresConnection) | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.