Skip to content

Added DISABLE_DYNAMIC_RATE_LIMITING compilation toggle#207

Merged
Morcules merged 5 commits into
Morcules:mainfrom
AM-Shafin:fix-issue-206
Jun 24, 2026
Merged

Added DISABLE_DYNAMIC_RATE_LIMITING compilation toggle#207
Morcules merged 5 commits into
Morcules:mainfrom
AM-Shafin:fix-issue-206

Conversation

@AM-Shafin

@AM-Shafin AM-Shafin commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Added DISABLE_DYNAMIC_RATE_LIMITING which should make the library use less CPU, costing only a tiny bit slow sending speed as described.

@Morcules

Copy link
Copy Markdown
Owner

Thank you for the contribution, I really appreciate the help

There’s just a few things missing:

  • In process_packets, there’s a packet type that handles the delay signals .
  • In send_packets there’s a usleep function handling rate limiting.
  • Please remove last_index_checked and last_chunks_received_number from SwiftNetPendingMessage.

Again, thank you for your help. If you have any questions don't mind asking me. I will try to merge it ASAP.

@Morcules Morcules linked an issue Jun 22, 2026 that may be closed by this pull request
@AM-Shafin

Copy link
Copy Markdown
Contributor Author

Hello, thank you very much for making a detailed comment on the parts I've overlooked. It was really helpful since I'm very new to "contribution" and network related projects.

Right now I'm trying to work on the last point, about removing the 2 variables called last_index_checked and last_chunks_received_number from the struct SwiftNetPendingMessage{} , but if I search the project for their use, it seems these variables are being used quite a few times in process_packets.c file.

Apologies if asking the obvious: should I wrap the 2 stated variables in #ifndef DISABLE_DYNAMIC_RATE_LIMITING like I did for other parts? If so my code is ready to push online.

Thank you in advance for your patience!

@Morcules

Copy link
Copy Markdown
Owner

Don’t apologize for asking simple questions, even I am kinda lost in the codebase since it’s big and i’m reworking some things in another branch.

Sorry for not pointing out everything, I tried to help ASAP, because I was at work while responding. Just looked at the commit containing implementation of rate limiting and this should be all of it.

Both fields (last_chunks_received_number and last_index_checked) are only for the sole reason of rate limiting, so please wrap every usage of them in the #ifndef.
Also please could you wrap also the #define PACKET_DELAY_UPDATE, enum PacketDelayUpdateStatus definition (swift_net.h), line 311 in send_packet.c (current_send_delay initialization), _Atomic uint32_t current_send_delay in SwiftNetPacketSending and also the whole switch case statement for PACKET_DELAY_UPDATE in process packets not only the content?

If you need any help, just let me know. If tests pass without problems, I will merge it. I’m working till 11PM UTC+2, so I will probably not respond till tomorrow.

@AM-Shafin

Copy link
Copy Markdown
Contributor Author

Thank you very much for giving even more detailed instructions and for the encouragement! I couldn't allocate time before 11PM today due to personal reasons. I would be glad if you could take a look at it tomorrow for any changes that I might need to make or missed from previous comment.

For the latest commits I've

  • pushed the request changes after verifying building the project locally
  • removed the unintentionally added build.log file from the commit.

@Morcules Morcules merged commit 2a2d198 into Morcules:main Jun 24, 2026
1 check passed
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.

Make Dynamic rate limiting be a compile-time feature

2 participants