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

core.app: remove garbage when using pace_breathing #1287

Merged
merged 1 commit into from
Apr 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core/app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,9 @@ function pace_breathing ()
else
sleep = math.floor(sleep/2)
end
lastfrees = counter.read(frees)
lastfreebytes = counter.read(freebytes)
lastfreebits = counter.read(freebits)
lastfrees = tonumber(counter.read(frees))
lastfreebytes = tonumber(counter.read(freebytes))
lastfreebits = tonumber(counter.read(freebits))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really what you want? At some point counter.read(frees) will stop being equal to lastfrees because the tonumber() may lose precision. Seems to me better to make lastfrees etc to be uint64_t values in some allocated FFI data.

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'm not sure this is a problem in practice (it will occur after something like 10 years of processing 14Mpps or something, I guess) but, sure, using a "box" for that would be safe. BTW, why exactly are we keeping lastfreebytes and lastfreebits? They're not used anywhere.

Copy link
Member

Choose a reason for hiding this comment

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

I think @lukego introduced them in 45b23d4 and 8b1bc0e but even then they were not used. I’d say its safe to drop them.

end
end

Expand Down