mina-sshd
mina-sshd copied to clipboard
ChannelShell. getInvertedOut() cannot be closed
Version
2.9.2
Bug description
//close
if (channelShell != null) {
channelShell.close(true);
channelShell.getInvertedOut().close();
}
try {
ChannelShell channelShell = clientSession.createShellChannel();
OpenFuture open = channelShell.open();
if (open.await(3000, TimeUnit.SECONDS)) {
if (open.isOpened()) {
byte[] buffer = new byte[1024];
int i;
//TODO ChannelShell关闭,不会让这里停止,甚至channelShell.getInvertedOut().close()都不行
while ((i = channelShell.getInvertedOut().read(buffer)) != -1) {
sendToFrontend(session, Arrays.copyOfRange(buffer, 0, i));
}
} else {
throw new BusinessException("通道打开失败");
}
} else {
throw new BusinessException("连接超时");
}
} catch (IOException e) {
throw new BusinessException("通道创建失败:" + e.getMessage());
}
Closing ChannelShell will not stop channelShell. getInvertedOut(), even channelShell. getInvertedOut().close()
Actual behavior
Closing ChannelShell will not stop channelShell. getInvertedOut(), even channelShell. getInvertedOut().close()
Expected behavior
Close ChannelShell to close channelShell. getInvertedOut()
try {
ChannelShell channelShell = clientSession.createShellChannel();
OpenFuture open = channelShell.open();
if (open.await(3000, TimeUnit.SECONDS)) {
if (open.isOpened()) {
byte[] buffer = new byte[1024];
int i;
//TODO Closing ChannelShell will not stop channelShell. getInvertedOut(), even channelShell. getInvertedOut().close()
while ((i = channelShell.getInvertedOut().read(buffer)) != -1) {
sendToFrontend(session, Arrays.copyOfRange(buffer, 0, i));
}
} else {
throw new BusinessException("通道打开失败");
}
} else {
throw new BusinessException("连接超时");
}
} catch (IOException e) {
throw new BusinessException("通道创建失败:" + e.getMessage());
}
Relevant log output
No response
Other information
No response