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

Collapse pending/active/capacity maps in connstate.State #173

Merged
merged 4 commits into from
Jun 6, 2019

Conversation

codygibb
Copy link
Contributor

@codygibb codygibb commented Jun 3, 2019

Instead of managing three maps for pending/active/capacity (which was complex in it's own
respect), just have a single map with a status field, and then group conns by torrent. Allows us
to ask questions like "how many active conns does this torrent have?" without having to loop
through a global active conns map.

This is shown by the new Saturated function.

type status int

const (
_uninit status = iota
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add some comments about what each means

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think pending / active are fairly obvious in the context of this file... There's a big comment above State which describes the semantics of pending / active.

@codecov-io
Copy link

codecov-io commented Jun 3, 2019

Codecov Report

Merging #173 into master will decrease coverage by 0.1%.
The diff coverage is 89.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #173      +/-   ##
==========================================
- Coverage   67.38%   67.27%   -0.11%     
==========================================
  Files         180      180              
  Lines        8805     8811       +6     
==========================================
- Hits         5933     5928       -5     
- Misses       2122     2133      +11     
  Partials      750      750
Impacted Files Coverage Δ
lib/torrent/scheduler/dispatch/dispatcher.go 49.33% <ø> (-3.74%) ⬇️
lib/torrent/scheduler/events.go 71.15% <100%> (-1.58%) ⬇️
lib/torrent/scheduler/connstate/state.go 90.76% <88.73%> (+0.25%) ⬆️
core/peer_info.go 88.88% <0%> (+5.55%) ⬆️

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 c721f6c...e46a44c. Read the comment docs.

@codygibb codygibb merged commit dd763e3 into master Jun 6, 2019
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.

3 participants