File tree Expand file tree Collapse file tree
sshlib/src/main/kotlin/org/connectbot/sshlib/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2048,6 +2048,7 @@ class SshConnection(
20482048 private fun startPacketLoop () {
20492049 if (packetLoopJob != null ) return
20502050 packetLoopJob = connectionScope.launch {
2051+ var loopException: Exception ? = null
20512052 try {
20522053 while (isActive) {
20532054 processNextPacket()
@@ -2061,14 +2062,17 @@ class SshConnection(
20612062 } else {
20622063 logger.warn(" Packet loop ended unexpectedly" , e)
20632064 }
2064- _disconnectedFlow .tryEmit(e)
2065+ loopException = e
20652066 } finally {
20662067 for (ch in channels.values) {
20672068 ch.onClose()
20682069 }
20692070 for (ch in forwardingChannels.values) {
20702071 ch.onClose()
20712072 }
2073+ if (loopException != null ) {
2074+ _disconnectedFlow .tryEmit(loopException)
2075+ }
20722076 }
20732077 }
20742078 }
You can’t perform that action at this time.
0 commit comments