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: data race with trustedCIDRs (#2674) #2675

Merged
merged 5 commits into from Apr 8, 2021
Merged

fix: data race with trustedCIDRs (#2674) #2675

merged 5 commits into from Apr 8, 2021

Conversation

fifsky
Copy link
Contributor

@fifsky fifsky commented Apr 8, 2021

The RemoteIP function does not have to do the prepareTrustedCIDRs() every time, because engine.Run done it once at startup. This is only for unit testing when loading trusted IP

So you only need to manually execute the PrepareTrustedCIDRS () in the unit test

@codecov
Copy link

codecov bot commented Apr 8, 2021

Codecov Report

Merging #2675 (240bc02) into master (d496f64) will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2675      +/-   ##
==========================================
- Coverage   98.67%   98.67%   -0.01%     
==========================================
  Files          41       41              
  Lines        2038     2036       -2     
==========================================
- Hits         2011     2009       -2     
  Misses         15       15              
  Partials       12       12              
Impacted Files Coverage Δ
context.go 97.63% <ø> (-0.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d496f64...240bc02. Read the comment docs.

Copy link
Member

@thinkerou thinkerou left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@thinkerou thinkerou added this to the v1.7.1 milestone Apr 8, 2021
@thinkerou thinkerou added the bug label Apr 8, 2021
@appleboy appleboy merged commit 03e5e05 into gin-gonic:master Apr 8, 2021
2 of 3 checks passed
@yiranzai
Copy link
Contributor

this pr causes the engine.prepareTrustedCIDRS to never execute if gin is not started via gin.RUN()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants