diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-04-17 14:11:43 +0200 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2024-04-24 18:53:16 +0000 |
commit | 99750d5cae843e01180bc0baeafc06da78d1b0b7 (patch) | |
tree | 089fc0571666e81e179746a980c70a9fbdb42d8a /src | |
parent | dafdb1181b9f64848caa2265a563444ffcf5e370 (diff) |
See related ticket for full rant and historical facts about this
callback.
Since anyway we are still developing osmo_io stuff and there will be ABI
breaks when releasing new version, let's udpate the callback signature
too.
Related: OS#6437
Change-Id: Ib8d77e30b1ea759ee5ac2a69d704e81ea71e3079
Diffstat (limited to 'src')
-rw-r--r-- | src/core/osmo_io.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c index b589cb71..af096e6e 100644 --- a/src/core/osmo_io.c +++ b/src/core/osmo_io.c @@ -267,7 +267,7 @@ struct iofd_msghdr *iofd_txqueue_dequeue(struct osmo_io_fd *iofd) */ static enum iofd_seg_act iofd_handle_segmentation(struct osmo_io_fd *iofd, struct msgb *msg, struct msgb **pending_out) { - int extra_len, received_len; + int extra_len, received_len, expected_len; struct msgb *msg_pending; /* Save the start of message before segmentation_cb (which could change it) */ @@ -275,12 +275,15 @@ static enum iofd_seg_act iofd_handle_segmentation(struct osmo_io_fd *iofd, struc received_len = msgb_length(msg); - if (!iofd->io_ops.segmentation_cb) { + if (iofd->io_ops.segmentation_cb2) { + expected_len = iofd->io_ops.segmentation_cb2(iofd, msg); + } else if (iofd->io_ops.segmentation_cb) { + expected_len = iofd->io_ops.segmentation_cb(msg); + } else { *pending_out = NULL; return IOFD_SEG_ACT_HANDLE_ONE; } - int expected_len = iofd->io_ops.segmentation_cb(msg); if (expected_len == -EAGAIN) { goto defer; } else if (expected_len < 0) { @@ -599,6 +602,9 @@ static int check_mode_callback_compat(enum osmo_io_fd_mode mode, const struct os return false; if (ops->recvmsg_cb || ops->sendmsg_cb) return false; + /* Forbid both segementation_cb set, something is wrong: */ + if (ops->segmentation_cb && ops->segmentation_cb2) + return false; break; case OSMO_IO_FD_MODE_RECVFROM_SENDTO: if (ops->read_cb || ops->write_cb) |