refactor: optimize rendering, log loading, and restructure tests#9
Merged
refactor: optimize rendering, log loading, and restructure tests#9
Conversation
Replace deprecated message-based authentication and channel APIs with modern callback-based server implementation (libssh 0.9+). Changes: - Replace ssh_message_auth_password with auth_password_function callback - Replace ssh_message_channel_request_pty_* with channel_pty_request_function - Remove #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - Implement session_context_t to pass state between callbacks - Fix event loop to wait for auth, channel open, AND channel ready (PTY/shell/exec) Key improvements: - Eliminates message loop complexity (libssh handles state machine) - Proper handling of SSH exec requests (e.g., "ssh host exit") - More maintainable and future-proof code Testing: - All tests passing (17/17) - Basic functionality: 3/3 - Anonymous access: 2/2 - Security features: 11/11 - Stress test: pass This closes the maintenance debt listed in TODO.md and ensures compatibility with future libssh versions.
Owner
Author
🔍 全面审查报告✅ 审查结论:批准合并这个 PR 是高质量的性能优化和代码重构,符合"好品味"标准。 核心改动审查1. 性能优化 - message.c 🟢 优秀日志加载优化:
评价:
Impact: 大日志文件启动速度从数秒 → 毫秒级 2. 渲染优化 - tui.c 🟢 优秀消除视觉闪烁:
评价:
3. libssh API 迁移 🟢 优秀废弃 API 替换:
4. Vim 快捷键增强 🟢 优秀
测试验证 ✅ 17/17 全部通过本地测试:
CI/CD:
代码质量【品味评分】🟢 好品味为什么?
【问题检查】
Linus 式评价"Good. Merge it." 这个 PR 做对了三件事:
合并条件检查:
准备合并。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses critical performance bottlenecks and improves the project structure for maintainability.
Key Changes
Performance Optimization:
message_loadto scanmessages.logbackwards from the end. Startup complexity reduced from O(FileSize) to O(MaxMessages).src/tui.cto use line clearing (\033[K) instead of full-screen clearing (\033[2J), eliminating visual flicker.User Experience (Vim Mode):
Ctrl+W(Delete Word) andCtrl+U(Delete Line) in Insert/Command modes.Ctrl+Cbehavior to safely switch modes instead of terminating the connection abruptly.\nas Enter key in Insert mode (fixing piped input issues).Project Structure:
test_*.shscripts totests/directory to declutter root.testtarget toMakefile.TNT_VERSIONmacro toinclude/common.h.README.mdto reflect new testing procedure.CI/CD:
.github/workflows/ci.ymlto execute the new comprehensive test suite viamake testandtest_security_features.sh.Verification
make testlocally.tests/test_security_features.shlocally.tests/test_stress.shlocally.