rpma_ep_next_conn_req(3)

πŸ“¦
version 1.3.0 Β· 3 versions
, in ubuntu noble

πŸ’– rpma_ep_next_conn_req(3) πŸ’–

okay bestie, sit down, hydrate, and let's talk about rpma_ep_next_conn_req from the RPMA Programmer's Manual. this is the little function that goes "hey, somebody's trying to slide into your DMs" β€” except the DMs are connection requests and the somebody is a remote peer. ✨


🌸 NAME 🌸

rpma_ep_next_conn_req β€” obtain an incoming connection request 🫢

like, that's it. that's the whole job. grab the next connection request that showed up at your endpoint. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#include <librpma.h>

struct rpma_ep;
struct rpma_conn_cfg;
struct rpma_conn_req;
int rpma_ep_next_conn_req(struct rpma_ep *ep, const struct rpma_conn_cfg *cfg,
                struct rpma_conn_req **req_ptr);

okay so first we declare the types: struct rpma_ep (your endpoint, the main character), struct rpma_conn_cfg (the config, the supporting cast), and struct rpma_conn_req (the request itself, the plot twist). then the function signature drops. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

rpma_ep_next_conn_req() obtains the next connection request from the endpoint. πŸŽ€

that's the vibe. the endpoint ep is out here living its life, and this function is like "okay what's next in the queue" and hands you back a request through req_ptr. it's giving receptionist energy, honestly. πŸ’…


🌈 RETURN VALUE 🌈

rpma_ep_next_conn_req() returns 0 on success or a negative error code on failure. 😭

and listen β€” on failure, rpma_ep_next_conn_req() does not set the *req_ptr value. so don't go dereferencing it like it's gonna be fine, because it is NOT gonna be fine. check your return code first, always. periodt.


πŸ’€ ERRORS πŸ’€

rpma_ep_next_conn_req() can fail with the following errors:

  • RPMA_E_INVAL β€” ep or req_ptr is NULL πŸ™ˆ (you passed a nothing where a something should be, bestie)
  • RPMA_E_INVAL β€” obtained an event different than a connection request 😭 (so you got something, just not the thing you wanted. it's giving wrong order at the drive-thru)
  • RPMA_E_PROVIDER β€” rdma_get_cm_event(3) failed πŸ’€ (the underlying provider layer said no)
  • RPMA_E_NOMEM β€” out of memory 🫠 (the classic)
  • RPMA_E_NO_EVENT β€” no next connection request available πŸŽ€ (nothing in the queue, nobody's calling, the phone is silent, go touch grass)
fr fr, two different things can hand you RPMA_E_INVAL β€” a NULL ep/req_ptr, OR an event that turned out to not be a connection request. don't assume which one it was. 🧚

⭐ SEE ALSO ⭐

go read those next, they're all connected, it's a whole cinematic universe. iykyk. πŸ‘‘


RPMA β€” 01 April 2024 β€” and that's rpma_ep_next_conn_req(3), signing off πŸ’œ mwah, go handle your connection requests responsibly bestie πŸŽ€βœ¨

πŸ“¦ where this page comes from