diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-10-17 13:46:19 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-10-17 13:48:07 +0200 |
commit | d8c5a906b4f528847b5624a10f3517801c72cf92 (patch) | |
tree | e9c8ecdbe926d8fe6d1d1552953be8179e9f73ad /src/stream.c | |
parent | 5bf2832145176ae64237b18ce6df802f34762e11 (diff) |
stream: Introduce APIs osmo_stream_{cli,srv}_clear_tx_queue()
Related: SYS#6113
Change-Id: Iecb0a4bc281647673d2930d1f1586a2df231af52
Diffstat (limited to 'src/stream.c')
-rw-r--r-- | src/stream.c | 17 |
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); +} + /*! @} */ |