[S] Change in libosmo-netif[master]: stream: Set state to closed before calling disconnect_cb()
daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-netif/+/33344 ) Change subject: stream: Set state to closed before calling disconnect_cb() ...................................................................... stream: Set state to closed before calling disconnect_cb() Fixes recent crashes in ttcn-cbc-test Change-Id: I40ceb17c32d1f58f8d0eeda8d1d794cf3f478e83 --- M src/stream.c 1 file changed, 16 insertions(+), 3 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-netif refs/changes/44/33344/1 diff --git a/src/stream.c b/src/stream.c index 31aa058..c710e1b 100644 --- a/src/stream.c +++ b/src/stream.c @@ -337,6 +337,8 @@ * abstraction and close the socket */ void osmo_stream_cli_close(struct osmo_stream_cli *cli) { + int old_state = cli->state; + if (cli->state == STREAM_CLI_STATE_CLOSED) return; if (cli->state == STREAM_CLI_STATE_WAIT_RECONNECT) { @@ -357,13 +359,13 @@ OSMO_ASSERT(false); } - if (cli->state == STREAM_CLI_STATE_CONNECTED) { + cli->state = STREAM_CLI_STATE_CLOSED; + + if (old_state == STREAM_CLI_STATE_CONNECTED) { LOGSCLI(cli, LOGL_DEBUG, "connection closed\n"); if (cli->disconnect_cb) cli->disconnect_cb(cli); } - - cli->state = STREAM_CLI_STATE_CLOSED; } static inline int osmo_stream_cli_fd(const struct osmo_stream_cli *cli) -- To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/33344 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-netif Gerrit-Branch: master Gerrit-Change-Id: I40ceb17c32d1f58f8d0eeda8d1d794cf3f478e83 Gerrit-Change-Number: 33344 Gerrit-PatchSet: 1 Gerrit-Owner: daniel <dwillmann@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
daniel