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

Check if connection name was already set when storing it #3824

Merged
merged 1 commit into from Jan 27, 2023

Conversation

wallyqs
Copy link
Member

@wallyqs wallyqs commented Jan 27, 2023

Signed-off-by: Waldemar Quevedo wally@nats.io

/cc @nats-io/core

Signed-off-by: Waldemar Quevedo <wally@nats.io>
@wallyqs wallyqs changed the base branch from dev to main January 27, 2023 21:09
@wallyqs wallyqs changed the base branch from main to dev January 27, 2023 21:09
@derekcollison derekcollison self-requested a review January 27, 2023 21:10
@@ -1883,7 +1883,7 @@ func (c *client) processConnect(arg []byte) error {
}
}
if ncs != _EMPTY_ {
c.ncs.Store(fmt.Sprintf("%s - %q", c, ncs))
c.ncs.CompareAndSwap(nil, fmt.Sprintf("%s - %q", c, ncs))
Copy link
Member

Choose a reason for hiding this comment

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

This Go 1.19 only?

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like built-in since Go 1.17: https://pkg.go.dev/sync/atomic#Value.CompareAndSwap

Copy link
Member

Choose a reason for hiding this comment

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

Does this change pass the fuzz test?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes this would fix it

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

None yet

2 participants