LC_CTX_RATELIMIT(3)

πŸ’– LC_CTX_RATELIMIT(3) β€” the Librecast Programmer's Manual, bestie edition πŸ’–

okay so. you're here because you wanna put a lil speed limit on your sockets and channels. no cap, this is the page for that. it's a section 3 man page from the Librecast programmer's manual, and we're gonna get you fluent in it. πŸ¦‹


✨ NAME ✨

lc_ctx_ratelimit, lc_channel_ratelimit β€” set send/recv ratelimits

literally what it says. you set the limits, the vibes stay calm. πŸ’…


πŸ“š LIBRARY πŸ“š

Librecast library (liblibrecast, -llibrecast)


🌸 SYNOPSIS 🌸

#include <librecast/net.h>

void lc_ctx_ratelimit(lc_ctx_t *ctx, size_t bps_out, size_t bps_in);
void lc_channel_ratelimit(lc_channel_t *chan, size_t bps_out, size_t bps_in);

Compile and link with -llibrecast.

like, don't forget that flag. she's essential. πŸŽ€


πŸ’« DESCRIPTION πŸ’«

So lc_ctx_ratelimit sets the default ratelimits for subsequent sockets and channels created with context ctx. future you's sockets. the ones not born yet. it's giving "setting the vibe for the children." 🧚

bps_out and bps_in specify the ratelimits in bits per second for outbound (send) and inbound (recv) respectively. yes bestie, bits, not bytes, don't come for me, that's what it says. These limits are applied to future sockets and channels created with lc_socket_new(3) and lc_channel_new(3).

⚠️ Existing sockets and channels are unaffected. they already got their vibe check. no takebacks. πŸ’€

lc_channel_ratelimit(3) sets the rate limits for channel chan similarly. same energy, different target. one's the whole context, one's a single channel. slay. ✨


πŸ”™ RETURN VALUE πŸ”™

These functions return no value. void. nothing. empty-handed but make it iconic. 🫢


😭 ERRORS 😭

None.

not a single one. no errors, no drama, no chaos. we love a low-maintenance function. 🌈


πŸ“ NOTES πŸ“

Only the send limit is enforced at this time.

so like, recv is out here living its truth unregulated for now. not me pointing that out, the man page did. πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

go read those next, bestie, the lore runs deep. πŸ’œ


πŸŽ€ the sign-off πŸŽ€

This whole thing came to you from LIBRECAST, dated 2023-07-23, and it lives under the name LC_CTX_RATELIMIT(3). that's the tea. drink responsibly. πŸ’…βœ¨πŸŒΈ

πŸ“¦ where this page comes from