mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
simlplify read from channel loop
main thread ui updates in disconnect()
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
// Created by neon443 on 06/06/2025.
|
// Created by neon443 on 06/06/2025.
|
||||||
//
|
//
|
||||||
|
|
||||||
VERSION = 1.1
|
VERSION = 1.1.1
|
||||||
BUILD = 1
|
BUILD = 1
|
||||||
|
|
||||||
// Configuration settings file format documentation can be found at:
|
// Configuration settings file format documentation can be found at:
|
||||||
|
|||||||
@@ -127,8 +127,10 @@ class SSHHandler: @unchecked Sendable, ObservableObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func disconnect() {
|
func disconnect() {
|
||||||
|
DispatchQueue.main.async {
|
||||||
withAnimation { self.state = .idle }
|
withAnimation { self.state = .idle }
|
||||||
withAnimation { self.testSuceeded = nil }
|
withAnimation { self.testSuceeded = nil }
|
||||||
|
}
|
||||||
|
|
||||||
//send eof if open
|
//send eof if open
|
||||||
if ssh_channel_is_open(channel) == 1 {
|
if ssh_channel_is_open(channel) == 1 {
|
||||||
|
|||||||
@@ -31,15 +31,12 @@ final class SSHTerminalView: TerminalView, Sendable, @preconcurrency TerminalVie
|
|||||||
|
|
||||||
while handler.connected {
|
while handler.connected {
|
||||||
if let read = handler.readFromChannel() {
|
if let read = handler.readFromChannel() {
|
||||||
Task { [weak self] in
|
// Task { [weak self] in
|
||||||
guard let self else { return }
|
// guard let self else { return }
|
||||||
await MainActor.run {
|
Task { @MainActor in
|
||||||
CATransaction.begin()
|
self.feed(text: read)
|
||||||
CATransaction.setDisableActions(true)
|
|
||||||
feed(text: read)
|
|
||||||
CATransaction.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
try? await Task.sleep(nanoseconds: 10_000_000) //10ms
|
try? await Task.sleep(nanoseconds: 10_000_000) //10ms
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user