uNetworking / uNetworking/uSockets

Rate limiting

Open
#27 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
1.5k
Forks
307
PR merge metrics
No merged PRs in 30d

Description

  • TCP has two separate lines: read & write, they can be separately frozen.
  • TLS does not, you cannot properly freeze read without potentially freezing write.
  • We want the common denominator.

us_socket_pause, us_socket_resume, us_ssl_socket_pause, us_ssl_socket_resume for freezing and resuming both lines.

Protocols like HTTP where clients can POST large streams of data are properly solved with this,

HTTP POST sends data until done, and THEN the server writes the response. Throttling upload to server is easily done with us_socket_pause, since the server won't send anything until the upload is done anyways. So it works, most web protocols are not dependent on the ability to freeze only the read or write part of the connection, that's probably why SSL works for these protocols.

Should be simple thing to remove from epoll on pause and add again on resume.

TCP-only extensions for freezing only one part can be added later if needed, as tcp-only functions.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the socket event-loop implementation and the epoll handling described in the issue. Trace how TCP and TLS sockets are registered, then assess the us_socket_pause/resume and us_ssl_socket_pause/resume entry points across the supported platforms. Done means both lines can be paused and resumed through the proposed common API without breaking existing HTTP-style traffic.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.