Keep sgsn subsystems under struct sgsn_instance lifecycle
Rework initialization and destruction of several sgsn subsystems to be
allocated & released together with the struct sgsn_instance.
This makes it easier to destroy and recreate the entire context and
allows us to start moving global variables scattered around to be under
struct sgsn_instance.
Change-Id: Idf60519b8e475b94d38bbb69e737132a5afaefab
diff --git a/src/sgsn/sgsn_cdr.c b/src/sgsn/sgsn_cdr.c
index 24d7524..ac0a6fd 100644
--- a/src/sgsn/sgsn_cdr.c
+++ b/src/sgsn/sgsn_cdr.c
@@ -41,7 +41,6 @@
/* TODO...avoid going through a global */
extern struct sgsn_instance *sgsn;
-extern struct ctrl_handle *g_ctrlh;
/**
* The CDR module will generate an entry like:
@@ -65,7 +64,7 @@
static void send_cdr_trap(char *value)
{
- if (ctrl_cmd_send_trap(g_ctrlh, "cdr-v1", value) < 0)
+ if (ctrl_cmd_send_trap(sgsn->ctrlh, "cdr-v1", value) < 0)
LOGP(DGPRS, LOGL_ERROR, "Failed to create and send TRAP cdr-v1\n");
}
@@ -300,3 +299,8 @@
return 0;
}
+
+void sgsn_cdr_release(struct sgsn_instance *sgsn)
+{
+ osmo_signal_unregister_handler(SS_SGSN, handle_sgsn_sig, sgsn);
+}