Attention is currently required from: arehbein, laforge, fixeria. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/31533 ) Change subject: common: Have PCU socket connection use osmo_wqueue ...................................................................... Patch Set 9: (2 comments) File src/common/pcu_sock.c: https://gerrit.osmocom.org/c/osmo-bts/+/31533/comment/3a377072_536f8195 PS6, Line 990: pcu_sock_close(state);
I think this was not yet addressed? Not sure what you are talking about arehbein. pcu_sock_send() is not creating the sturct msgb, but the caller expects it to take ownsership of the object, hence it is the duty of pcu_sock_send() to make sure the object is always freed. Similary, osmo_wqueue_enqueue is expected to take ownsership of the message if it doesn't fail, that's what the documentation of the API states. Hence, it's pcu_sock_send() duty to free the object to avoid the leak.
https://gerrit.osmocom.org/c/osmo-bts/+/31533/comment/10d00429_f8c74f74 PS6, Line 1106: rc = osmo_wqueue_enqueue(&state->upqueue, m);
Thanks for the reference, I'm now returning `-errno` just in case `write()` causes `errno` to be `EB […] No, that's wrong. write() returning -EBADF doesn't mean we should return it. -EBADF is a return code with a specific meaning the callback should return in case it frees the related object/ofd.
I wouldn't return -errno here in all cases, but rather return specific errnos based on what's needed, to avoid unexpected consequences (eg -EBADF forwarded from write() to the calle of thi function). -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/31533 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: Ia6e61dda4b3cd4bba76e6acb7771d70335062fe1 Gerrit-Change-Number: 31533 Gerrit-PatchSet: 9 Gerrit-Owner: arehbein <arehbein@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-Reviewer: pespin <pespin@sysmocom.de> Gerrit-CC: laforge <laforge@osmocom.org> Gerrit-Attention: arehbein <arehbein@sysmocom.de> Gerrit-Attention: laforge <laforge@osmocom.org> Gerrit-Attention: fixeria <vyanitskiy@sysmocom.de> Gerrit-Comment-Date: Thu, 08 Jun 2023 21:58:25 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: arehbein <arehbein@sysmocom.de> Comment-In-Reply-To: pespin <pespin@sysmocom.de> Comment-In-Reply-To: fixeria <vyanitskiy@sysmocom.de> Gerrit-MessageType: comment