[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. stream_{cli,srv}: Add 'res' param to read_cb2 Notify user about read errors, similar to what is supported in the earlier ofd cb backend of osmo_stream_cli/srv: https://osmocom.org/issues/6405#note-15 Related: OS#6405 Fixes: 5fec34a9f20c3b8769373d1b28ae2062e5e2bdd6 Fixes: 0245cf5e07855abea72693272c55b50b5a93aff4 Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M examples/ipa-stream-client.c M examples/ipa-stream-server.c M examples/stream-client.c M examples/stream-server.c M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c M tests/stream/stream_test.c 8 files changed, 176 insertions(+), 58 deletions(-) Approvals: jolly: Looks good to me, but someone else must approve osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c index 720fe66..b58370e 100644 --- a/examples/ipa-stream-client.c +++ b/examples/ipa-stream-client.c @@ -102,13 +102,19 @@ return 0; } -static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { int num; struct msg_sent *cur, *tmp, *found = NULL; LOGP(DIPATEST, LOGL_DEBUG, "received message from stream (payload len=%d)\n", msgb_length(msg)); + if (res <= 0) { + LOGP(DIPATEST, LOGL_ERROR, "Event with no data! %d\n", res); + msgb_free(msg); + return 0; + } + if (osmo_ipa_process_msg(msg) < 0) { LOGP(DIPATEST, LOGL_ERROR, "bad IPA message\n"); msgb_free(msg); diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c index 5317921..e87eab4 100644 --- a/examples/ipa-stream-server.c +++ b/examples/ipa-stream-server.c @@ -47,8 +47,15 @@ exit(EXIT_SUCCESS); } -int read_cb(struct osmo_stream_srv *conn, struct msgb *msg) +int read_cb(struct osmo_stream_srv *conn, int res, struct msgb *msg) { + if (res <= 0) { + LOGP(DSTREAMTEST, LOGL_ERROR, "cannot receive message (%d)\n", res); + msgb_free(msg); + osmo_stream_srv_destroy(conn); + return -EBADF; + } + LOGP(DSTREAMTEST, LOGL_DEBUG, "received message from stream (payload len=%d)\n", msgb_length(msg)); osmo_ipa_msg_push_headers(msg, osmo_ipa_msgb_cb_proto(msg), osmo_ipa_msgb_cb_proto_ext(msg)); diff --git a/examples/stream-client.c b/examples/stream-client.c index cae0153..6d20263 100644 --- a/examples/stream-client.c +++ b/examples/stream-client.c @@ -54,10 +54,17 @@ return 0; } -static int read_cb(struct osmo_stream_cli *conn, struct msgb *msg) +static int read_cb(struct osmo_stream_cli *conn, int res, struct msgb *msg) { LOGP(DSTREAMTEST, LOGL_NOTICE, "receiving message from stream... "); + if (res < 0) { + LOGPC(DSTREAMTEST, LOGL_ERROR, "cannot receive message (res = %d)\n", res); + msgb_free(msg); + return 0; + } + + LOGPC(DSTREAMTEST, LOGL_NOTICE, "got %d bytes: %s\n", msg->len, msgb_hexdump(msg)); msgb_free(msg); diff --git a/examples/stream-server.c b/examples/stream-server.c index f6332dc..5295c2b 100644 --- a/examples/stream-server.c +++ b/examples/stream-server.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -44,10 +45,20 @@ signal(SIGINT, SIG_DFL); } -int read_cb(struct osmo_stream_srv *conn, struct msgb *msg) +int read_cb(struct osmo_stream_srv *conn, int res, struct msgb *msg) { LOGP(DSTREAMTEST, LOGL_NOTICE, "receiving message from stream... "); + if (res <= 0) { + if (res < 0) + LOGPC(DSTREAMTEST, LOGL_ERROR, "cannot receive message: %s\n", strerror(-res)); + else + LOGPC(DSTREAMTEST, LOGL_ERROR, "client closed connection\n"); + msgb_free(msg); + osmo_stream_srv_destroy(conn); + return -EBADF; + } + LOGPC(DSTREAMTEST, LOGL_NOTICE, "got %d bytes: %s\n", msg->len, msgb_hexdump(msg)); msgb_free(msg); diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h index 398b277..3c4ec7e 100644 --- a/include/osmocom/netif/stream.h +++ b/include/osmocom/netif/stream.h @@ -102,7 +102,14 @@ typedef int (*osmo_stream_srv_read_cb_t)(struct osmo_stream_srv *conn); typedef int (*osmo_stream_srv_closed_cb_t)(struct osmo_stream_srv *conn); -typedef int (*osmo_stream_srv_read_cb2_t)(struct osmo_stream_srv *conn, struct msgb *msg); + +/*! Completion call
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 5: Code-Review+2 (1 comment) Patchset: PS5: MSC_Tests also passed fine (216 success, 1 more than last nightly in jenkins). I'm merging this one now and I'll retrigger the dependant patches gerrit-jenkins job after OBS have built them. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 5 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: laforge Gerrit-Comment-Date: Thu, 18 Apr 2024 13:45:58 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: laforge, pespin. jolly has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 5: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 5 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Thu, 18 Apr 2024 13:35:41 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: jolly, laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 5: Code-Review+1 (1 comment) Patchset: PS5: Letting the others to take a look at this patch (would do CR+2 otherwise). -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 5 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Thu, 18 Apr 2024 09:17:50 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: fixeria, jolly, laforge, pespin. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 5: Code-Review+1 (1 comment) File include/osmocom/netif/stream.h: https://gerrit.osmocom.org/c/libosmo-netif/+/36574/comment/6e03d594_c6ec07c7 PS4, Line 107: srv > Ack Done -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 5 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Attention: fixeria Gerrit-Comment-Date: Thu, 18 Apr 2024 08:57:43 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Comment-In-Reply-To: osmith Comment-In-Reply-To: pespin Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: fixeria, jolly, laforge, osmith. Hello Jenkins Builder, fixeria, jolly, laforge, osmith, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email to look at the new patch set (#5). The following approvals got outdated and were removed: Code-Review+1 by fixeria, Code-Review+1 by osmith, Verified+1 by Jenkins Builder Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. stream_{cli,srv}: Add 'res' param to read_cb2 Notify user about read errors, similar to what is supported in the earlier ofd cb backend of osmo_stream_cli/srv: https://osmocom.org/issues/6405#note-15 Related: OS#6405 Fixes: 5fec34a9f20c3b8769373d1b28ae2062e5e2bdd6 Fixes: 0245cf5e07855abea72693272c55b50b5a93aff4 Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 --- M examples/ipa-stream-client.c M examples/ipa-stream-server.c M examples/stream-client.c M examples/stream-server.c M include/osmocom/netif/stream.h M src/stream_cli.c M src/stream_srv.c M tests/stream/stream_test.c 8 files changed, 176 insertions(+), 58 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/74/36574/5 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 5 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: osmith Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: fixeria Gerrit-MessageType: newpatchset
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: jolly, laforge, osmith. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 4: (1 comment) File include/osmocom/netif/stream.h: https://gerrit.osmocom.org/c/libosmo-netif/+/36574/comment/577dacb6_d221ee2c PS4, Line 107: srv > conn Ack -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 4 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: osmith Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Comment-Date: Thu, 18 Apr 2024 08:45:47 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: osmith Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: jolly, laforge, pespin. osmith has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 4: Code-Review+1 (1 comment) File include/osmocom/netif/stream.h: https://gerrit.osmocom.org/c/libosmo-netif/+/36574/comment/cbf86b49_65d439b6 PS4, Line 107: srv conn -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 4 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: osmith Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Thu, 18 Apr 2024 08:22:01 + Gerrit-HasComments: Yes Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: jolly, laforge, pespin. fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 4 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: pespin Gerrit-Comment-Date: Wed, 17 Apr 2024 19:16:49 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: fixeria, jolly, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 4: (1 comment) Patchset: PS4: > When this is merged, then the related libosmo-sccp and osmo-bsc patches need > to be merged: […] BSC_Tests also passed fine with the patchset applied. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 4 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: fixeria Gerrit-Comment-Date: Wed, 17 Apr 2024 17:38:34 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: fixeria, jolly, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 4: (1 comment) Patchset: PS4: > This seems to be working well so far after running stuff like STP_Tests, > HNBGW_Tests, plus the follo […] When this is merged, then the related libosmo-sccp and osmo-bsc patches need to be merged: https://gerrit.osmocom.org/c/libosmo-sccp/+/36575 https://gerrit.osmocom.org/c/osmo-bsc/+/36576 -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 4 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: fixeria Gerrit-Comment-Date: Wed, 17 Apr 2024 16:14:33 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: pespin Gerrit-MessageType: comment
[M] Change in libosmo-netif[master]: stream_{cli,srv}: Add 'res' param to read_cb2
Attention is currently required from: fixeria, jolly, laforge. pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email ) Change subject: stream_{cli,srv}: Add 'res' param to read_cb2 .. Patch Set 4: (1 comment) This change is ready for review. Patchset: PS4: This seems to be working well so far after running stuff like STP_Tests, HNBGW_Tests, plus the following scenario which was triggering errors reported by Vadim: 1) cd osmo-ttcn3-hacks/msc/ 2) osmo-stp -c osmo-stp.cfg 3) osmo-msc -c osmo-msc.cfg It can be reviewed and merged. -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/36574?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I395c75ff1e9904757ce1d767a9ac2f779593c4c8 Gerrit-Change-Number: 36574 Gerrit-PatchSet: 4 Gerrit-Owner: pespin Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: jolly Gerrit-Reviewer: laforge Gerrit-Reviewer: pespin Gerrit-Attention: jolly Gerrit-Attention: laforge Gerrit-Attention: fixeria Gerrit-Comment-Date: Wed, 17 Apr 2024 16:13:44 + Gerrit-HasComments: Yes Gerrit-Has-Labels: No Gerrit-MessageType: comment