This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.
Holger Hans Peter Freyther holger at freyther.deOn Mon, Mar 31, 2014 at 10:53:32AM +0200, Jacob Erlbeck wrote:
Dear Jacob,
> + /* first read our 3-byte header */
> + needed = sizeof(*hh) - msg->len;
> + ret = recv(fd, msg->tail, needed, 0);
> + if (ret == 0)
> + goto discard_msg;
> +
> + if (ret < 0) {
> + if (errno == EAGAIN || errno == EINTR)
> + ret = 0;
> + else {
> + ret = -errno;
> + goto discard_msg;
> + }
> + }
> +
> + msgb_put(msg, ret);
> +
> + if (ret < needed) {
> + if (msg->len == 0) {
> + ret = -EAGAIN;
> + goto discard_msg;
> + }
> +
> + LOGP(DLINP, LOGL_INFO,
> + "Received part of IPA message header (%d/%d)\n",
> + msg->len, sizeof(*hh));
^ tab vs. spaces?
> + if (!tmp_msg) {
> + ret = -EIO;
> + goto discard_msg;
> + }
> + *tmp_msg = msg;
> + return -EAGAIN;
> + }
> +
> + msg->l2h = msg->tail;
> + }
> + if (needed > 0) {
> + ret = recv(fd, msg->tail, needed, 0);
> +
> + if (ret == 0)
> + goto discard_msg;
> +
> + if (ret < 0) {
> + if (errno == EAGAIN || errno == EINTR)
> + ret = 0;
> + else {
> + ret = -errno;
> + goto discard_msg;
> + }
> + }
> +
> + msgb_put(msg, ret);
> +
> + if (ret < needed) {
> + LOGP(DLINP, LOGL_INFO,
> + "Received part of IPA message L2 data (%d/%d)\n",
> + msgb_l2len(msg), len);
> + if (!tmp_msg) {
> + ret = -EIO;
> + goto discard_msg;
> + }
> + *tmp_msg = msg;
> + return -EAGAIN;
> + }
> }
Do you think readability would be improved if these two paths could be
united? I will push and make releases today for this new feature.