aboutsummaryrefslogtreecommitdiffstats
path: root/examples/stream-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/stream-server.c')
-rw-r--r--examples/stream-server.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/stream-server.c b/examples/stream-server.c
index cd6dc57..31487a0 100644
--- a/examples/stream-server.c
+++ b/examples/stream-server.c
@@ -56,9 +56,12 @@ int read_cb(struct osmo_stream_srv *conn)
bytes = osmo_stream_srv_recv(conn, msg);
- if (bytes < 0) {
- LOGPC(DSTREAMTEST, LOGL_ERROR, "cannot receive message: %s\n", strerror(-bytes));
- return 0;
+ if (bytes <= 0) {
+ if (bytes < 0)
+ LOGPC(DSTREAMTEST, LOGL_ERROR, "cannot receive message: %s\n", strerror(-bytes));
+ else
+ LOGPC(DSTREAMTEST, LOGL_ERROR, "client closed connection\n");
+ osmo_stream_srv_destroy(conn);
} else
LOGPC(DSTREAMTEST, LOGL_NOTICE, "got %d (%d) bytes: %s\n", bytes, msg->len, msgb_hexdump(msg));