diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-04-16 19:11:58 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2024-04-18 10:55:13 +0200 |
commit | 05ff552f25cde5d84f428421bd4d2d64fae0bc9d (patch) | |
tree | 2106b0a857960293a5231e049eeb88b4f61c78cb /examples/ipa-stream-server.c | |
parent | 01f33ec93fa355f9cd1016610d7fe92cde5aaa2d (diff) |
stream_{cli,srv}: Add 'res' param to read_cb2pespin/stream
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
Diffstat (limited to 'examples/ipa-stream-server.c')
-rw-r--r-- | examples/ipa-stream-server.c | 9 |
1 files changed, 8 insertions, 1 deletions
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 @@ void sighandler(int foo) 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)); |