aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/ipa-stream-client.c7
-rw-r--r--examples/ipa-stream-server.c9
2 files changed, 12 insertions, 4 deletions
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index b771fa3..db1ce62 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -96,7 +96,6 @@ static int connect_cb(struct osmo_stream_cli *conn)
static int read_cb(struct osmo_stream_cli *conn)
{
struct msgb *msg;
- struct osmo_fd *ofd = osmo_stream_cli_get_ofd(conn);
LOGP(DIPATEST, LOGL_DEBUG, "received message from stream\n");
@@ -105,10 +104,14 @@ static int read_cb(struct osmo_stream_cli *conn)
LOGP(DIPATEST, LOGL_ERROR, "cannot allocate message\n");
return 0;
}
- if (osmo_ipa_msg_recv(ofd->fd, msg) <= 0) {
+ if (osmo_stream_cli_recv(conn, msg) <= 0) {
LOGP(DIPATEST, LOGL_ERROR, "cannot receive message\n");
return 0;
}
+ if (osmo_ipa_process_msg(msg) < 0) {
+ LOGP(DIPATEST, LOGL_ERROR, "bad IPA message\n");
+ return 0;
+ }
int num;
struct msg_sent *cur, *tmp, *found = NULL;
diff --git a/examples/ipa-stream-server.c b/examples/ipa-stream-server.c
index 69e0280..c370d5f 100644
--- a/examples/ipa-stream-server.c
+++ b/examples/ipa-stream-server.c
@@ -46,7 +46,6 @@ void sighandler(int foo)
int read_cb(struct osmo_stream_srv *conn)
{
struct msgb *msg;
- struct osmo_fd *ofd = osmo_stream_srv_get_ofd(conn);
LOGP(DSTREAMTEST, LOGL_DEBUG, "received message from stream\n");
@@ -55,12 +54,18 @@ int read_cb(struct osmo_stream_srv *conn)
LOGP(DSTREAMTEST, LOGL_ERROR, "cannot allocate message\n");
return 0;
}
- if (osmo_ipa_msg_recv(ofd->fd, msg) <= 0) {
+ if (osmo_stream_srv_recv(conn, msg) <= 0) {
LOGP(DSTREAMTEST, LOGL_ERROR, "cannot receive message\n");
osmo_stream_srv_destroy(conn);
msgb_free(msg);
return 0;
}
+ if (osmo_ipa_process_msg(msg) < 0) {
+ LOGP(DSTREAMTEST, LOGL_ERROR, "Bad IPA message\n");
+ msgb_free(msg);
+ return 0;
+ }
+
osmo_stream_srv_send(conn, msg);
return 0;
}