bsc: Make open/close work on the sccp data
diff --git a/openbsc/src/bsc/osmo_bsc_api.c b/openbsc/src/bsc/osmo_bsc_api.c
index b8423b2..8ee857d 100644
--- a/openbsc/src/bsc/osmo_bsc_api.c
+++ b/openbsc/src/bsc/osmo_bsc_api.c
@@ -99,12 +99,12 @@
conn->bts->cell_identity);
if (!resp) {
LOGP(DMSC, LOGL_DEBUG, "Failed to create layer3 message.\n");
- bsc_delete_connection(conn);
+ bsc_delete_connection(conn->sccp_con);
return BSC_API_CONN_POL_REJECT;
}
- if (bsc_open_connection(conn, resp) != 0) {
- bsc_delete_connection(conn);
+ if (bsc_open_connection(conn->sccp_con, resp) != 0) {
+ bsc_delete_connection(conn->sccp_con);
msgb_free(resp);
return BSC_API_CONN_POL_REJECT;
}
diff --git a/openbsc/src/bsc/osmo_bsc_sccp.c b/openbsc/src/bsc/osmo_bsc_sccp.c
index 620082f..b1d128b 100644
--- a/openbsc/src/bsc/osmo_bsc_sccp.c
+++ b/openbsc/src/bsc/osmo_bsc_sccp.c
@@ -126,29 +126,30 @@
bsc_con->sccp = sccp;
bsc_con->msc_con = net->msc_data->msc_con;
+ bsc_con->conn = conn;
llist_add(&bsc_con->entry, &active_connections);
conn->sccp_con = bsc_con;
return 0;
}
-int bsc_open_connection(struct gsm_subscriber_connection *conn, struct msgb *msg)
+int bsc_open_connection(struct osmo_bsc_sccp_con *conn, struct msgb *msg)
{
LOGP(DMSC, LOGL_ERROR, "Not implemented yet.\n");
return -1;
}
-int bsc_delete_connection(struct gsm_subscriber_connection *conn)
+int bsc_delete_connection(struct osmo_bsc_sccp_con *sccp)
{
- struct osmo_bsc_sccp_con *sccp = conn->sccp_con;
-
if (!sccp)
return 0;
+ if (sccp->conn)
+ LOGP(DMSC, LOGL_ERROR, "Should have been cleared.\n");
+
llist_del(&sccp->entry);
bsc_del_timer(&sccp->sccp_it_timeout);
bsc_del_timer(&sccp->sccp_cc_timeout);
talloc_free(sccp);
- conn->sccp_con = NULL;
return 0;
}