aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-10-17 13:46:19 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2022-10-17 13:48:07 +0200
commitd8c5a906b4f528847b5624a10f3517801c72cf92 (patch)
treee9c8ecdbe926d8fe6d1d1552953be8179e9f73ad /src/stream.c
parent5bf2832145176ae64237b18ce6df802f34762e11 (diff)
stream: Introduce APIs osmo_stream_{cli,srv}_clear_tx_queue()
Diffstat (limited to 'src/stream.c')
-rw-r--r--src/stream.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/stream.c b/src/stream.c
index 12e32eb..0086588 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -905,6 +905,15 @@ int osmo_stream_cli_recv(struct osmo_stream_cli *cli, struct msgb *msg)
return ret;
}
+void osmo_stream_cli_clear_tx_queue(struct osmo_stream_cli *cli)
+{
+ msgb_queue_free(&cli->tx_queue);
+ /* If in state 'connecting', keep WRITE flag up to receive
+ * socket connection signal and then transition to STATE_CONNECTED: */
+ if (cli->state == STREAM_CLI_STATE_CONNECTED)
+ osmo_fd_write_disable(&cli->ofd);
+}
+
/*
* Server side.
*/
@@ -1591,4 +1600,12 @@ int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg)
return ret;
}
+void osmo_stream_srv_clear_tx_queue(struct osmo_stream_srv *conn)
+{
+ msgb_queue_free(&conn->tx_queue);
+ osmo_fd_write_disable(&conn->ofd);
+ if (conn->flags & OSMO_STREAM_SRV_F_FLUSH_DESTROY)
+ osmo_stream_srv_destroy(conn);
+}
+
/*! @} */