bsc_msc: Remove use_count from the subscriber connection
A channel will be released in case of
* Errors via the clear_request callback...
* no more transactions and operations are going on.
This means that if we do something without a transaction
the channel might be closed down right away. The bug fix
will be to create a transaction/operation.
diff --git a/openbsc/src/osmo_msc.c b/openbsc/src/osmo_msc.c
index 569634d..6a94e7a 100644
--- a/openbsc/src/osmo_msc.c
+++ b/openbsc/src/osmo_msc.c
@@ -24,6 +24,7 @@
#include <openbsc/bsc_api.h>
#include <openbsc/debug.h>
+#include <openbsc/transaction.h>
#include <openbsc/gsm_04_11.h>
@@ -64,3 +65,30 @@
struct bsc_api *msc_bsc_api() {
return &msc_handler;
}
+
+/* lchan release handling */
+void msc_release_connection(struct gsm_subscriber_connection *conn)
+{
+ struct gsm_trans *trans;
+
+ /* skip when we are in release, e.g. due an error */
+ if (conn->in_release)
+ return;
+
+ /* skip releasing of silent calls as they have no transaction */
+ if (conn->silent_call)
+ return;
+
+ /* check if there is a pending operation */
+ if (conn->loc_operation || conn->sec_operation)
+ return;
+
+ llist_for_each_entry(trans, &conn->bts->network->trans_list, entry) {
+ if (trans->conn == conn)
+ return;
+ }
+
+ /* no more connections, asking to release the channel */
+ conn->in_release = 1;
+ gsm0808_clear(conn);
+}