Fix clipped server badge and client_hands hang across servers
This commit is contained in:
@@ -350,6 +350,7 @@ struct Badge: View {
|
||||
var body: some View {
|
||||
Text("\(count)")
|
||||
.font(Fonts.font(11, weight: 700))
|
||||
.fixedSize()
|
||||
.foregroundStyle(Palette.danger)
|
||||
.padding(.horizontal, 7)
|
||||
.background(Palette.dangerTint, in: Capsule())
|
||||
|
||||
@@ -13,6 +13,7 @@ private let maxOutput = 64 << 10
|
||||
private let maxMessage = 256 << 20
|
||||
private let maxRead = 64 << 20
|
||||
private let copyTimeoutMs = 10 * 60 * 1000
|
||||
private let hands = Hands()
|
||||
|
||||
// The signature goes to a file, since a login shell's startup files can print to stdout.
|
||||
private let signScript = """
|
||||
@@ -28,7 +29,6 @@ private let signScript = """
|
||||
@MainActor
|
||||
final class Remote {
|
||||
let api: API
|
||||
private let hands = Hands()
|
||||
private var ws: URLSessionWebSocketTask?
|
||||
private var stopped = false
|
||||
private var heard = Date()
|
||||
@@ -63,9 +63,6 @@ final class Remote {
|
||||
checker?.cancel()
|
||||
ws?.cancel(with: .normalClosure, reason: nil)
|
||||
ws = nil
|
||||
Task { [hands] in
|
||||
await hands.stop()
|
||||
}
|
||||
}
|
||||
|
||||
// A socket byre closed while this Mac slept stays open here until something is sent on it.
|
||||
@@ -370,7 +367,6 @@ private struct HandsResponse: Decodable {
|
||||
}
|
||||
|
||||
private actor Hands {
|
||||
private var process: Process?
|
||||
private var input: FileHandle?
|
||||
private var next = 0
|
||||
private var pending: [Int: CheckedContinuation<OpenAPIObjectContainer, any Error>] = [:]
|
||||
@@ -392,10 +388,6 @@ private actor Hands {
|
||||
}
|
||||
}
|
||||
|
||||
func stop() {
|
||||
process?.terminate()
|
||||
}
|
||||
|
||||
private func running() throws -> FileHandle {
|
||||
if let input {
|
||||
return input
|
||||
@@ -410,7 +402,6 @@ private actor Hands {
|
||||
p.standardError = FileHandle.nullDevice
|
||||
let exit = try start(p)
|
||||
log.info("byre-hands started: pid \(p.processIdentifier)")
|
||||
process = p
|
||||
input = stdin.fileHandleForWriting
|
||||
Task {
|
||||
await serve(p, stdout.fileHandleForReading, exit)
|
||||
@@ -435,7 +426,6 @@ private actor Hands {
|
||||
for await _ in exit {}
|
||||
let status = p.terminationStatus
|
||||
log.info("byre-hands exited: status \(status)")
|
||||
process = nil
|
||||
input = nil
|
||||
let waiting = pending
|
||||
pending = [:]
|
||||
|
||||
Reference in New Issue
Block a user