uSockets icon indicating copy to clipboard operation
uSockets copied to clipboard

Rate limiting

Open ghost opened this issue 6 years ago • 0 comments

  • 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.

ghost avatar Jan 10 '19 11:01 ghost