Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadloop problem #8

Open
persist1116 opened this issue Apr 28, 2024 · 0 comments
Open

Deadloop problem #8

persist1116 opened this issue Apr 28, 2024 · 0 comments

Comments

@persist1116
Copy link

When the program is running, I don't know under what circumstances there will be a session connection that keeps opening. In the following code, the value of len has been consistently -1, and running this loop has caused the CPU to remain high. How do I solve this problem
while (true) { byte data[] = new byte[1024]; int len = inputStream.read(data); if (len != -1) { byte[] data1 = Arrays.copyOfRange(data, 0, len); TextMessage textMessage = new TextMessage(data1); if (initValid && isValidBash(textMessage, shellPath)) { break; } else { tryBash = true; initValid = false; } session.sendMessage(textMessage); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant