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

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

No files matched your search

+6
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;
+1 -1
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 }
@@ -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()
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.