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

close active listener when removing connection #25

Merged
merged 2 commits into from
Jan 7, 2022

Conversation

wasaga
Copy link
Contributor

@wasaga wasaga commented Jan 7, 2022

Summary

If there is an active listener associated with connection record,
previously it would be left active when connection is deleted, blocking the port
until application is restarted.

Related issues

Fixes https://github.com/pomerium/internal/issues/716

Checklist

  • reference any related issues
  • updated docs
  • updated unit tests
  • updated UPGRADING.md
  • add appropriate tag (improvement / bug / etc)
  • ready for review

@wasaga wasaga requested a review from a team as a code owner January 7, 2022 00:27
@wasaga wasaga added the bug Something isn't working label Jan 7, 2022
if err = s.config.delete(r.GetId()); err != nil {
ids = append(ids, r.GetId())
}
if _, err = s.disconnectLocked(ids); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does disconnect return an error if a connection isn't already connected?

if !there || !rec.Listening || rec.CancelFunc == nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the only error kind that may be returned is that there's no active listener.
the disconnectLocked would fill in ListenerStatus.LastError field, which we ignore during record deletion.

srv, err := api.NewServer(ctx)
require.NoError(t, err)

rec, err := srv.Upsert(ctx, &pb.Record{
Copy link
Contributor

@calebdoxsey calebdoxsey Jan 7, 2022

Choose a reason for hiding this comment

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

Could we add a second record to confirm non-connected listener deletion still works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

@wasaga wasaga merged commit c15cee3 into main Jan 7, 2022
@wasaga wasaga deleted the wasaga/close-listener-on-delete branch January 7, 2022 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants