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

Replace LRU cache blacklist implementation with a time cache #258

Merged
merged 3 commits into from
Feb 5, 2020

Conversation

aarshkshah1992
Copy link
Contributor

Copy link
Collaborator

@vyzo vyzo left a comment

Choose a reason for hiding this comment

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

this needs a mutex, timecache is not thread-safe.

blacklist.go Show resolved Hide resolved
blacklist.go Show resolved Hide resolved
blacklist.go Show resolved Hide resolved
@aarshkshah1992
Copy link
Contributor Author

@vyzo Have added a mutex. Thanks.

blacklist.go Outdated
b.tc.Add(p.String())
b.Unlock()
Copy link
Collaborator

Choose a reason for hiding this comment

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

defer this, it's more idiomatic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@vyzo
Copy link
Collaborator

vyzo commented Feb 5, 2020

thank you, will merge as soon as travis finishes.

@vyzo vyzo merged commit 40e1c94 into libp2p:master Feb 5, 2020
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.

2 participants