From beb74814bf228b413cbb4e8c92be6394cc87851f Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Mon, 24 Sep 2018 17:38:04 +0200 Subject: fix LCLS during Assignment: actually use new TCH lchan In assignment_success(), don't trigger lcls_apply_config() before the conn->lchan points at the actual new voice lchan. The entire LCLS code relies on conn->lchan. The assignment FSM wants to point conn->lchan to the new lchan only after it is sure that sending the Assignment Complete to the MSC was successful. However, a failure is a) very unlikely and b) if sending to the MSC fails we might as well tear the whole conn down anyway. Now, if sending to the MSC fails, release the lchan and the conn should clean itself up. Related: OS#1602 Change-Id: I8dd561d744d8081b5ac5ffa7635f17ac19bcda45 --- src/osmo-bsc/assignment_fsm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c index 5304d6c88..a7564e0cd 100644 --- a/src/osmo-bsc/assignment_fsm.c +++ b/src/osmo-bsc/assignment_fsm.c @@ -200,18 +200,22 @@ static void send_assignment_complete(struct gsm_subscriber_connection *conn, str static void assignment_success(struct gsm_subscriber_connection *conn) { + /* Take on the new lchan */ + gscon_change_primary_lchan(conn, conn->assignment.new_lchan); + conn->assignment.new_lchan = NULL; + /* apply LCLS configuration (if any) */ lcls_apply_config(conn); - send_assignment_complete(conn, conn->assignment.new_lchan); + send_assignment_complete(conn, conn->lchan); /* If something went wrong during send_assignment_complete(), the fi will be gone from * error handling in there. Almost a success, but then again the whole thing failed. */ - if (!conn->assignment.fi) + if (!conn->assignment.fi) { + /* The lchan was ready, and we failed to tell the MSC about it. By releasing this lchan, + * the conn will notice that its primary lchan is gone and should clean itself up. */ + lchan_release(conn->lchan, false, true, RSL_ERR_EQUIPMENT_FAIL); return; - - /* Take on the new lchan */ - gscon_change_primary_lchan(conn, conn->assignment.new_lchan); - conn->assignment.new_lchan = NULL; + } /* Rembered this only for error handling: should assignment fail, assignment_reset() will release * the MGW endpoint right away. If successful, the conn continues to use the endpoint. */ -- cgit v1.2.3