mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-cbc.git
synced 2025-10-23 08:22:19 +00:00
abis: Fix reusing link->conn while it is being destroyed
Call to osmo_stream_cli_destroy() may end up triggering disconnect_cb(), and we don't want to attempt doing more stuff with that conn when that happens (we were even trying to reconnect() it...). Avoid it by marking the pointer as NULL immediatelly before calling e1inp_sign_link_destroy(). Change-Id: I56605766af974d86610d0958f4b82e6e4ff94502
This commit is contained in:
@@ -102,6 +102,8 @@ static int cbc_cbsp_link_cli_connect_cb(struct osmo_stream_cli *conn)
|
||||
static int cbc_cbsp_link_cli_disconnect_cb(struct osmo_stream_cli *conn)
|
||||
{
|
||||
struct cbc_cbsp_link *link = osmo_stream_cli_get_data(conn);
|
||||
if (!link->conn) /* conn is being destroyed by us, we called osmo_stream_cli_destroy() */
|
||||
return 0;
|
||||
LOGPCC(link, LOGL_NOTICE, "Disconnected.\n");
|
||||
LOGPCC(link, LOGL_NOTICE, "Reconnecting...\n");
|
||||
osmo_stream_cli_reconnect(conn);
|
||||
@@ -364,10 +366,11 @@ void cbc_cbsp_link_close(struct cbc_cbsp_link *link)
|
||||
return;
|
||||
|
||||
if (link->is_client) {
|
||||
osmo_stream_cli_destroy(link->cli_conn);
|
||||
struct osmo_stream_cli *cli_conn = link->cli_conn;
|
||||
link->cli_conn = NULL;
|
||||
osmo_stream_cli_destroy(cli_conn);
|
||||
if (link->peer)
|
||||
link->peer->link.cbsp = NULL;
|
||||
link->cli_conn = NULL;
|
||||
if (link->fi)
|
||||
osmo_fsm_inst_dispatch(link->fi, CBSP_LINK_E_CMD_CLOSE, NULL);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user