Attention is currently required from: daniel, laforge, lynxis lazus.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/35078?usp=email )
Change subject: osmo_io: Factor out and use common send function from backend ......................................................................
Patch Set 2:
(3 comments)
File src/core/osmo_io.c:
https://gerrit.osmocom.org/c/libosmocore/+/35078/comment/65b7ef21_6f5bf225 PS1, Line 348: if (rc > 0 && rc < msgb_length(msg)) {
Regarding your comment about rc == 0, maybe one missing failure case is rc == 0 && rc < msgb_length […]
That should fall into the more generic "rc < msgb_length(msg)" condition, I don't think the specific case you mention should be handled differently.
https://gerrit.osmocom.org/c/libosmocore/+/35078/comment/442aee50_3a53f950 PS1, Line 360:
IMO rc == 0 in send means we have successfully "written" 0 bytes to the socket (which also means the […]
ack, makes sense, the special case for rc=0 is in the recv path (socket closed). I doubt we'll ever see rc=0 here, I'd expect it to return -EAGAIN instead.
send(len=0) would probably return an error, or maybe it returns 0 instead to mention it is writable.
File src/core/osmo_io_uring.c:
https://gerrit.osmocom.org/c/libosmocore/+/35078/comment/be9f52f1_8e2dfc28 PS2, Line 196: iofd_handle_send_completion(iofd, rc, msghdr); The goto can easily be dropped:
if (IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) { msgb_free(msghdr->msg); iofd_msghdr_free(msghdr); } else { iofd_handle_send_completion(iofd, rc, msghdr); }
iofd->u.uring.write_msghdr = NULL; /* submit the next to-be-transmitted message for this file descriptor */ if (iofd->u.uring.write_enabled && !IOFD_FLAG_ISSET(iofd, IOFD_FLAG_CLOSED)) iofd_uring_submit_tx(iofd);
You can btw probably ass OSMO_UNLIKELY() to the if condition checking IOFD_FLAG_CLOSED.