nitb: Release the channel if there is nothing on it

This is more a work around and one still needs to implement a
proper dispatch on the opening of the connection. If there is no
operation left, no transaction and no silent call, close down the
channel.
This commit is contained in:
Holger Hans Peter Freyther 2012-11-23 21:33:15 +01:00
parent 6d818839a9
commit 70ae5d3000
3 changed files with 21 additions and 5 deletions

View File

@ -72,5 +72,6 @@ void trans_free(struct gsm_trans *trans);
int trans_assign_trans_id(struct gsm_subscriber *subscr,
uint8_t protocol, uint8_t ti_flag);
int trans_has_conn(const struct gsm_subscriber_connection *conn);
#endif

View File

@ -53,7 +53,13 @@ static int msc_compl_l3(struct gsm_subscriber_connection *conn, struct msgb *msg
gsm0408_dispatch(conn, msg);
/* TODO: do better */
return BSC_API_CONN_POL_ACCEPT;
if (conn->silent_call)
return BSC_API_CONN_POL_ACCEPT;
if (conn->loc_operation || conn->sec_operation || conn->anch_operation)
return BSC_API_CONN_POL_ACCEPT;
if (trans_has_conn(conn))
return BSC_API_CONN_POL_ACCEPT;
return BSC_API_CONN_POL_REJECT;
}
static void msc_dtap(struct gsm_subscriber_connection *conn, uint8_t link_id, struct msgb *msg)
@ -162,10 +168,8 @@ void msc_release_connection(struct gsm_subscriber_connection *conn)
if (conn->loc_operation || conn->sec_operation || conn->anch_operation)
return;
llist_for_each_entry(trans, &conn->bts->network->trans_list, entry) {
if (trans->conn == conn)
return;
}
if (trans_has_conn(conn))
return;
/* no more connections, asking to release the channel */
conn->in_release = 1;

View File

@ -149,3 +149,14 @@ int trans_assign_trans_id(struct gsm_subscriber *subscr,
return -1;
}
int trans_has_conn(const struct gsm_subscriber_connection *conn)
{
struct gsm_trans *trans;
llist_for_each_entry(trans, &conn->bts->network->trans_list, entry)
if (trans->conn == conn)
return 1;
return 0;
}