Skip to content

chore: Remove unnecessary SSHProxy.Serve() method#344

Open
minhtule wants to merge 1 commit into
masterfrom
feat/mt/remove-redundant-check
Open

chore: Remove unnecessary SSHProxy.Serve() method#344
minhtule wants to merge 1 commit into
masterfrom
feat/mt/remove-redundant-check

Conversation

@minhtule

Copy link
Copy Markdown
Contributor

Changes

Remove unnecessary SSHProxy.Serve() method because it duplicates logic in SSHProxy.serveConn().

Comment on lines -150 to -165
p.mu.Lock()

if p.shuttingDown {
p.mu.Unlock()
// reject the connection and return error
err := conn.Close()
if err != nil {
p.config.logger.Error("Failed to close connection", zap.Error(err))
}

return errShuttingDown
}

p.mu.Unlock()

return p.serveConn(ctx, conn)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

serveConn has the exact same logic to check for shutting down so this method is unnecessary.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the exported SSHProxy.Serve() method and routes connection handling directly through the existing SSHProxy.serveConn() implementation to eliminate duplicated shutdown-guard logic.

Changes:

  • Updated SSHProxy.Start() to call serveConn() directly for each accepted connection.
  • Removed the now-redundant SSHProxy.Serve() wrapper method.
  • Updated the shutdown-related unit test to invoke serveConn().

Reviewed changes

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

File Description
internal/sshhandler/proxy.go Removes Serve() and switches Start() to call serveConn() directly.
internal/sshhandler/proxy_test.go Updates the shutdown/active-connection test to call serveConn() instead of Serve().

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

Comment thread internal/sshhandler/proxy.go
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.17%. Comparing base (ae1a656) to head (083eed9).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #344      +/-   ##
==========================================
+ Coverage   86.07%   86.17%   +0.09%     
==========================================
  Files          40       40              
  Lines        2830     2820      -10     
==========================================
- Hits         2436     2430       -6     
+ Misses        269      266       -3     
+ Partials      125      124       -1     
Flag Coverage Δ
integration 54.91% <100.00%> (+0.05%) ⬆️
unit 78.61% <100.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/sshhandler/proxy.go 83.65% <100.00%> (+3.82%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@minhtule minhtule marked this pull request as ready for review June 26, 2026 21:08
@minhtule minhtule requested a review from clement0010 June 26, 2026 21:08

@clement0010 clement0010 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍🏻

@minhtule minhtule requested a review from sghiocel June 29, 2026 14:20
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.

3 participants