Skip to content

Comments

feat(ipc): prevent redundant data path updates and fix socket path typo#334

Merged
garmr-ulfr merged 1 commit intomainfrom
fix-error-on-set
Feb 21, 2026
Merged

feat(ipc): prevent redundant data path updates and fix socket path typo#334
garmr-ulfr merged 1 commit intomainfrom
fix-error-on-set

Conversation

@garmr-ulfr
Copy link
Collaborator

This pull request introduces a couple of targeted improvements to the VPN IPC server codebase. The changes focus on correcting the default socket path and optimizing the settings update logic to avoid unnecessary operations.

Socket Path Correction:

  • Changed the default value of _socketPath in socket.go from /var/run/lantern/lantern.sock to /var/run/lantern/lanternd.sock to ensure the server uses the correct Unix socket file.

Settings Update Optimization:

  • Updated setSettingsPathHandler in set.go to immediately return a 200 OK response if the requested settings path is already set, preventing redundant updates and unnecessary log entries.

Copilot AI review requested due to automatic review settings February 21, 2026 01:07
@garmr-ulfr
Copy link
Collaborator Author

Minor fix. Merging.

@garmr-ulfr garmr-ulfr merged commit 58e7974 into main Feb 21, 2026
4 checks passed
@garmr-ulfr garmr-ulfr deleted the fix-error-on-set branch February 21, 2026 01:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request corrects the Unix socket path for the VPN daemon IPC server and adds an optimization to prevent redundant settings path updates. The socket path change aligns the filename with the daemon's name (lanternd), and the optimization attempts to skip unnecessary operations when the settings path hasn't changed.

Changes:

  • Updated default socket path from /var/run/lantern/lantern.sock to /var/run/lantern/lanternd.sock to match the daemon name
  • Added early return in setSettingsPathHandler to avoid redundant operations when the settings path is unchanged

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
vpn/ipc/socket.go Corrected socket filename to match daemon name (lanternd.sock)
vpn/ipc/set.go Added early return optimization when settings path unchanged

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +48 to +51
if old == opt.SettingsPath {
w.WriteHeader(http.StatusOK)
return
}
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early return optimization may not work correctly in all cases. The comparison checks if old == opt.SettingsPath, but lines 54-58 show that opt.SettingsPath may be modified to append a filename before being stored. This means:

  1. If old is /home/user/.config/lantern/settings.yaml and opt.SettingsPath is /home/user/.config/lantern, the early return won't trigger.
  2. However, after the path manipulation at lines 56-58, the final path would become /home/user/.config/lantern/settings.yaml, which is identical to old.
  3. This would cause unnecessary operations (settings update and reload) even though the path hasn't actually changed.

The comparison should be performed after the path manipulation logic, or the comparison should account for both the directory and file path forms. Consider moving the early return check to after line 58, comparing old with the potentially modified path variable instead.

Copilot uses AI. Check for mistakes.
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

Successfully merging this pull request may close these issues.

1 participant