aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ipa-stream-client.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2019-02-20 17:12:34 +0100
committerMax <msuraev@sysmocom.de>2019-02-20 17:33:32 +0100
commitaf63d87a76ef4ae010e230d86ce9c07c6081cb80 (patch)
treefa0106633f0016b0b9b5fb5644d729f6e1fd2492 /examples/ipa-stream-client.c
parentfe3527da2ac691c961f767c97d70bfe00d1e4d10 (diff)
Stream client: add disconnect callback
It's similar to connect_cb() but called once client has been disconnected. Change-Id: I905adb2d6191216551a3bcdcd1aec1f96f01612a
Diffstat (limited to 'examples/ipa-stream-client.c')
-rw-r--r--examples/ipa-stream-client.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/ipa-stream-client.c b/examples/ipa-stream-client.c
index 2151090..ec7d2b3 100644
--- a/examples/ipa-stream-client.c
+++ b/examples/ipa-stream-client.c
@@ -54,6 +54,13 @@ void sighandler(int foo)
exit(EXIT_SUCCESS);
}
+static int disconnect_cb(struct osmo_stream_cli *conn)
+{
+ LOGP(DIPATEST, LOGL_NOTICE, "disconnected\n");
+
+ return 0;
+}
+
static int connect_cb(struct osmo_stream_cli *conn)
{
int *__num_msgs = osmo_stream_cli_get_data(conn);
@@ -176,6 +183,7 @@ int main(int argc, char *argv[])
osmo_stream_cli_set_addr(conn, "127.0.0.1");
osmo_stream_cli_set_port(conn, 10000);
osmo_stream_cli_set_connect_cb(conn, connect_cb);
+ osmo_stream_cli_set_disconnect_cb(conn, disconnect_cb);
osmo_stream_cli_set_read_cb(conn, read_cb);
osmo_stream_cli_set_data(conn, &num_msgs);