pespin has uploaded this change for review.
stream: Introduce APIs osmo_stream_{cli,srv}_clear_tx_queue()
Related: SYS#6113
Change-Id: Iecb0a4bc281647673d2930d1f1586a2df231af52
---
M TODO-RELEASE
M include/osmocom/netif/stream.h
M src/stream.c
3 files changed, 22 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/76/29776/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index e7fab50..5629a9c 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,4 @@
#library what description / commit summary line
libosmo-netif osmux new osmux_xfrm_output_* APIs
libosmo-netif osmux new osmux_xfrm_input_* APIs
+libosmo-netif stream new APIs osmo_stream_{cli,srv}_clear_tx_queue()
\ No newline at end of file
diff --git a/include/osmocom/netif/stream.h b/include/osmocom/netif/stream.h
index 793e578..ce8f1d2 100644
--- a/include/osmocom/netif/stream.h
+++ b/include/osmocom/netif/stream.h
@@ -56,6 +56,8 @@
void osmo_stream_srv_send(struct osmo_stream_srv *conn, struct msgb *msg);
int osmo_stream_srv_recv(struct osmo_stream_srv *conn, struct msgb *msg);
+void osmo_stream_srv_clear_tx_queue(struct osmo_stream_srv *conn);
+
/*! \brief Osmocom Stream Client: Single client connection */
struct osmo_stream_cli;
@@ -91,4 +93,6 @@
void osmo_stream_cli_send(struct osmo_stream_cli *cli, struct msgb *msg);
int osmo_stream_cli_recv(struct osmo_stream_cli *cli, struct msgb *msg);
+void osmo_stream_cli_clear_tx_queue(struct osmo_stream_cli *cli);
+
/*! @} */
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 @@
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 @@
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);
+}
+
/*! @} */
To view, visit change 29776. To unsubscribe, or for help writing mail filters, visit settings.