-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a1c812
commit 33c7db5
Showing
3 changed files
with
0 additions
and
21 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
src/main/kotlin/com/jetpackduba/gitnuro/ssh/libssh/streams/LibSshChannelInputErrStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,27 @@ | ||
package com.jetpackduba.gitnuro.ssh.libssh.streams | ||
|
||
import com.jetpackduba.gitnuro.logging.printLog | ||
import com.jetpackduba.gitnuro.ssh.libssh.SSHLibrary | ||
import com.jetpackduba.gitnuro.ssh.libssh.ssh_channel | ||
import java.io.InputStream | ||
|
||
private const val TAG = "LibSshChannelInputErrSt" | ||
|
||
class LibSshChannelInputErrStream(private val sshChannel: ssh_channel) : InputStream() { | ||
private var cancelled = false | ||
private val sshLib = SSHLibrary.INSTANCE | ||
|
||
override fun read(): Int { | ||
printLog(TAG, "Read error") | ||
val buffer = ByteArray(1) | ||
|
||
return if (sshLib.ssh_channel_poll(sshChannel, 1) > 0) { | ||
sshLib.ssh_channel_read(sshChannel, buffer, 1, 1) | ||
|
||
val first = buffer.first() | ||
|
||
printLog(TAG, "Read error finished ${first.toInt()} - ${String(buffer)}") | ||
|
||
first.toInt() | ||
} else | ||
-1 | ||
} | ||
|
||
override fun close() { | ||
println("Closing error") | ||
cancelled = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/main/kotlin/com/jetpackduba/gitnuro/ssh/libssh/streams/LibSshChannelOutputStream.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters