bug: Unhandled Exception: SSHStateError(Transport is closed)
when the remote reboot or shutdown
the done handler not working. `await session.done;
client.close();
await client.done;`
the error is.
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SSHStateError(Transport is closed)
#0 SSHTransport.sendPacket (package:dartssh2/src/ssh_transport.dart:183:7)
#1 SSHClient._sendMessage (package:dartssh2/src/ssh_client.dart:480:16)
#2 SSHChannelController._sendEOFIfNeeded (package:dartssh2/src/ssh_channel.dart:264:16)
#3 SSHChannelController.close (package:dartssh2/src/ssh_channel.dart:195:5)
#4 SSHClient._closeChannels (package:dartssh2/src/ssh_client.dart:447:15)
#5 SSHClient._handleTransportClosed (package:dartssh2/src/ssh_client.dart:467:5)
#6 new SSHClient.
void sendPacket(Uint8List data) { if (isClosed) { return; throw SSHStateError('Transport is closed'); }
i add return before throw SSHStateError('Transport is closed'); and then temporary solve.
I have the same error except the error occurs when I connect to my Cisco catalyst switch 2960 serires in the first run I get the result then when using the same client one more time to excute the same command it says :
SSHStateError(Transport is closed)
My Code :
static cisco(SSHClient client) async {
await client.ping();
print(await client.run('show env fan'));
await client.ping();
}
BTW : the same code runs on all other devices very well