Skip to content

Replace RWMutex with sync.Once and atomic int, reuse error#11

Open
aviddiviner wants to merge 1 commit intomailgun:masterfrom
aviddiviner:sync-once
Open

Replace RWMutex with sync.Once and atomic int, reuse error#11
aviddiviner wants to merge 1 commit intomailgun:masterfrom
aviddiviner:sync-once

Conversation

@aviddiviner
Copy link
Copy Markdown

What do you think of this little tweak?

Replaced the sync.RWMutex with a sync.Once so then I can check for isClosed() on an atomic int. This makes it cheap to check before each Accept() so we don't need to error out unnecessarily on the underlying listener.

Also, it's always nice to delete more code than you add :)

@aviddiviner
Copy link
Copy Markdown
Author

I'm posting the PR here because it seems like braintree/manners has become a little abandoned, and this fork is where the magic is happening.

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