aboutsummaryrefslogtreecommitdiffstats
path: root/examples/stream-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stream-client.c')
-rw-r--r--examples/stream-client.c9
1 files changed, 8 insertions, 1 deletions
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 @@ static int disconnect_cb(struct osmo_stream_cli *conn)
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);