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

meter total bytes sent to a socket? #1296

Open
slingamn opened this issue Oct 1, 2020 · 2 comments · May be fixed by #1785
Open

meter total bytes sent to a socket? #1296

slingamn opened this issue Oct 1, 2020 · 2 comments · May be fixed by #1785

Comments

@slingamn
Copy link
Member

slingamn commented Oct 1, 2020

Seems easy enough to add a uint64 counter to each Socket for this --- could be useful for abuse detection later on.

@slingamn slingamn added this to the v2.5 milestone Oct 29, 2020
@slingamn slingamn modified the milestones: v2.5, v2.6 Dec 10, 2020
@slingamn
Copy link
Member Author

Implementation notes:

  1. Add bytesWritten and bytesRead fields to the Socket struct (type uint64). bytesWritten needs to be synchronized by the embedded mutex. bytesRead doesn't need to be synchronized because reading isn't concurrency-safe anyway (sockets are read only from the dedicated client goroutine).
  2. Export copies of these fields in (*Client).AllSessionData, make them visible in NS CLIENTS LIST and possibly other places

@slingamn slingamn modified the milestones: v2.6, v2.7 Apr 7, 2021
@slingamn slingamn modified the milestones: v2.7, v2.8 May 30, 2021
@slingamn
Copy link
Member Author

Actually bytesRead does need synchronization, because otherwise how are you going to read the value?

slingamn added a commit to slingamn/ergo that referenced this issue Aug 26, 2021
@slingamn slingamn modified the milestones: v2.8, v2.9 Oct 3, 2021
@slingamn slingamn modified the milestones: v2.9, v2.10 Jan 2, 2022
@slingamn slingamn modified the milestones: v2.10, v2.11 Apr 26, 2022
@slingamn slingamn modified the milestones: v2.11, selected Dec 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant