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

Fixed size oracle #523

Merged
merged 2 commits into from
Feb 6, 2019
Merged

Fixed size oracle #523

merged 2 commits into from
Feb 6, 2019

Conversation

gavraz
Copy link
Contributor

@gavraz gavraz commented Feb 6, 2019

Added package with the fixed size oracle


func cloneMap(m map[string]struct{}) map[string]struct{} {
c := make(map[string]struct{}, len(m))
for k, v := range m {
Copy link
Contributor

Choose a reason for hiding this comment

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

you iterate a map without locking it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cloneMap is private and not thread-safe. We never call this function without enforcing safety.


func pickUnique(pickCount int, orig map[string]struct{}, dest map[string]struct{}) {
i := 0
for k := range orig { // randomly pass on clients
Copy link
Contributor

Choose a reason for hiding this comment

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

map is not locked

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pickUnique is private and not thread-safe. We never call this function without enforcing safety.

@gavraz gavraz merged commit 06ab4e2 into develop Feb 6, 2019
@y0sher y0sher deleted the fixed_oracle_package branch June 25, 2019 07:47
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