[bsc_hack] Initialize db as part of the network
Let us establish the rule that there is one DB
per network. This will allow to assign a BTS of
the network to a subscriber that is loaded from
the db across restarts.
diff --git a/src/bsc_hack.c b/src/bsc_hack.c
index ac109f1..3fbc7f6 100644
--- a/src/bsc_hack.c
+++ b/src/bsc_hack.c
@@ -916,6 +916,18 @@
paging_init(bts);
bts->paging.channel_allocated = bsc_hack_channel_allocated;
+ if (db_init(database_name)) {
+ printf("DB: Failed to init database. Please check the option settings.\n");
+ return -1;
+ }
+ printf("DB: Database initialized.\n");
+
+ if (db_prepare()) {
+ printf("DB: Failed to prepare database.\n");
+ return -1;
+ }
+ printf("DB: Database prepared.\n");
+
telnet_init(gsmnet, 4242);
/* E1 mISDN input setup */
@@ -1046,18 +1058,6 @@
/* parse options */
handle_options(argc, argv);
- if (db_init(database_name)) {
- printf("DB: Failed to init database. Please check the option settings.\n");
- return 1;
- }
- printf("DB: Database initialized.\n");
-
- if (db_prepare()) {
- printf("DB: Failed to prepare database.\n");
- return 1;
- }
- printf("DB: Database prepared.\n");
-
/* seed the PRNG */
srand(time(NULL));