Skip to content

Commit

Permalink
Remove libssh stream logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JetpackDuba committed May 3, 2023
1 parent 0a1c812 commit 33c7db5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.jetpackduba.gitnuro.ssh.libssh.SSHLibrary
import com.jetpackduba.gitnuro.ssh.libssh.ssh_channel
import java.io.InputStream


class LibSshChannelInputStream(private val sshChannel: ssh_channel) : InputStream() {
private val sshLib = SSHLibrary.INSTANCE

Expand All @@ -25,8 +24,6 @@ class LibSshChannelInputStream(private val sshChannel: ssh_channel) : InputStrea

val first = buffer.first()

print(String(buffer))

return first.toInt()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
package com.jetpackduba.gitnuro.ssh.libssh.streams

import com.jetpackduba.gitnuro.logging.printDebug
import com.jetpackduba.gitnuro.logging.printLog
import com.jetpackduba.gitnuro.ssh.libssh.SSHLibrary
import com.jetpackduba.gitnuro.ssh.libssh.ssh_channel
import java.io.OutputStream

private const val TAG = "LibSshChannelOutputStre"

class LibSshChannelOutputStream(private val sshChannel: ssh_channel) : OutputStream() {
private val sshLib = SSHLibrary.INSTANCE

override fun write(b: Int) {
printDebug(TAG, "Write int")

val byteArrayData = byteArrayOf(b.toByte())
write(byteArrayData)

printDebug(TAG, "Write int")
}

override fun write(b: ByteArray) {
printDebug(TAG, "Write byte")
sshLib.ssh_channel_write(sshChannel, b, b.size)
printDebug(TAG, "Write byte finished")
}

override fun close() {
printDebug(TAG, "Closing output")
}
}

Expand Down

0 comments on commit 33c7db5

Please sign in to comment.