fix(d1l): add keep-alive handler and improve password handling #44
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/d1l-auth-ping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This fixes the "Ping" failure issue where the D1L repeater was not responding to keep-alive requests from connected clients.
🤖 Generated with Claude Code
Description
Type of Change
Related Issues
Testing Performed
Hardware Tested
Code Quality Checklist
Breaking Changes
Screenshots/Logs
Additional Notes
Summary of Changes
Hello @okapteinis, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses several critical issues to improve the robustness and debuggability of the D1L repeater. It introduces proper handling for keep-alive pings from the MeshCore Companion App, enhances password management with better debugging information and defensive input sanitization, and rectifies a syntax error in the device time setting command. These changes collectively aim to improve device reliability and ease of troubleshooting.
Highlights
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either
/gemini <command>or@gemini-code-assist <command>. Below is a summary of the supported commands on the current page./gemini review/gemini summary/gemini helpCustomization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a
.gemini/folder in the base of the repository. Detailed instructions can be found here.Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩︎
Code Review
This pull request introduces several valuable fixes and enhancements. The addition of a keep-alive handler correctly addresses the ping failure issue. The improved debug logging for password authentication and the robust password handling (null-termination and whitespace trimming) are great for debugging and stability. The fix for the corrupted code block in the
CMD_SET_DEVICE_TIMEhandler is also a crucial correction. I've added a few suggestions insrc/helpers/CommonCLI.cppto further refine the new password handling logic by improving efficiency and reducing code duplication.@ -248,3 +254,3 @@savePrefs();sprintf(reply, "password now: %s", _prefs->password); // echo back just to let admin know for sure!!sprintf(reply, "password now: %s (len=%d)", _prefs->password, strlen(_prefs->password)); // echo back with length} else if (memcmp(command, "clear stats", 11) == 0) {There's a small optimization possible here. The
lenvariable, which holds the string length after trimming, is already available from the preceding lines. You can reuse it here instead of callingstrlen()again. This avoids a redundant calculation.This block of code for null-termination and whitespace trimming is identical to the one for the admin password at lines 248-253. To improve maintainability and reduce code duplication, consider extracting this logic into a private helper function within the
CommonCLIclass. This function could take achar*and its size as arguments.Similar to the admin password handling, you can optimize this by reusing the
lenvariable calculated just before. This avoids callingstrlen()again.