massively optimised reading from ssh, reduced cpu usage and energy usage

This commit is contained in:
neon443
2025-06-24 09:48:33 +01:00
parent 11a3db9307
commit 3f2c92cd91
3 changed files with 8 additions and 2 deletions

View File

@@ -615,6 +615,9 @@
MARKETING_VERSION = "$(VERSION)";
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.ShhShell;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;
@@ -648,6 +651,9 @@
MARKETING_VERSION = "$(VERSION)";
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.ShhShell;
PRODUCT_NAME = "$(TARGET_NAME)";
REGISTER_APP_GROUPS = YES;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 5.0;

View File

@@ -342,7 +342,7 @@ class SSHHandler: @unchecked Sendable, ObservableObject {
}
var buffer: [CChar] = Array(repeating: 0, count: 512)
let nbytes = ssh_channel_read(channel, &buffer, UInt32(buffer.count), 0)
let nbytes = ssh_channel_read_nonblocking(channel, &buffer, UInt32(buffer.count), 0)
guard nbytes > 0 else { return nil }

View File

@@ -35,7 +35,7 @@ final class SSHTerminalView: TerminalView, Sendable, @preconcurrency TerminalVie
await self.feed(text: read)
}
} else {
usleep(1_000_000)
usleep(100_000)
}
// self?.setNeedsDisplay()
}