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

Fix stun client datarace #1237

Merged
merged 2 commits into from
May 30, 2022
Merged

Fix stun client datarace #1237

merged 2 commits into from
May 30, 2022

Conversation

ersonp
Copy link
Contributor

@ersonp ersonp commented May 30, 2022

Did you run make format && make check?
yes

Fixes #1236

Changes:

  • Added stunReady and stunReadyOnce to Visor
  • Removed wgStunClient from Visor

How to test this PR:

  1. Add the line time.Sleep(time.Second * 5) before this
  2. Build the visor with -race flag
  3. Start the visor
  4. Open UI and keep refreshing

This commit fixes the datarace in the stun module by removing the waitgroup and instead using the stunReady channel along side  the method isStunReady.

The stunReady chan is used directly to block until the stun client is ready and the method isStunReady is used to check if the module is ready or not.
Copy link
Contributor

@mrpalide mrpalide left a comment

Choose a reason for hiding this comment

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

No data race be there, its OK, but seems a line should remove.

pkg/visor/init.go Outdated Show resolved Hide resolved
@mrpalide mrpalide merged commit 0c1aabe into skycoin:develop May 30, 2022
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