diff --git a/debian/changelog b/debian/changelog index e10763864..dc91079ce 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +nextepc (0.2-3~artful) artful; urgency=medium + + * MongoDB re-connect using systemd + + -- Sukchan Lee Tue, 31 Oct 2017 12:10:18 +0000 + +nextepc (0.2-3~zesty) zesty; urgency=medium + + * MongoDB re-connect using systemd + + -- Sukchan Lee Tue, 31 Oct 2017 12:07:36 +0000 + +nextepc (0.2-3~xenial) xenial; urgency=medium + + * MongoDB re-connect using systemd + + -- Sukchan Lee Tue, 31 Oct 2017 12:00:16 +0000 + nextepc (0.2-2~artful) artful; urgency=medium * Fix PGW installation diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 000000000..89ae9db8f --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/lib/base/context.c b/lib/base/context.c index a027d711c..cbcb83d77 100644 --- a/lib/base/context.c +++ b/lib/base/context.c @@ -271,7 +271,7 @@ status_t context_db_init(const char *db_uri) if (!mongoc_client_get_server_status(self.db_client, NULL, &reply, &error)) { d_error("Failed to conect to server [%s]", db_uri); - return CORE_ERROR; + return CORE_EAGAIN; } d_assert(bson_iter_init_find(&iter, &reply, "ok"), diff --git a/main.c b/main.c index d635c0349..145483050 100644 --- a/main.c +++ b/main.c @@ -80,6 +80,7 @@ int main(int argc, char *argv[]) * * Keep the order of starting-up */ + status_t rv; char *config_path = NULL; char *log_path = NULL; char *pid_path = NULL; @@ -138,8 +139,12 @@ int main(int argc, char *argv[]) core_initialize(); app_log_pid(pid_path); - if (app_initialize(config_path, log_path) != CORE_OK) + rv = app_initialize(config_path, log_path); + if (rv != CORE_OK) { + if (rv == CORE_EAGAIN) + return EXIT_SUCCESS; + d_fatal("NextEPC initialization failed. Aborted"); return EXIT_FAILURE; } diff --git a/src/init.c b/src/init.c index befc15048..65d5ae527 100644 --- a/src/init.c +++ b/src/init.c @@ -49,7 +49,7 @@ status_t app_will_initialize(const char *config_path, const char *log_path) if (rv != CORE_OK) return rv; } - return CORE_OK; + return rv; } status_t app_did_initialize(void) @@ -57,7 +57,7 @@ status_t app_did_initialize(void) status_t rv = app_logger_start(); if (rv != CORE_OK) return rv; - return CORE_OK; + return rv; } void app_will_terminate(void) diff --git a/support/systemd/nextepc-hssd.service.in b/support/systemd/nextepc-hssd.service.in index a6183d340..6018aba16 100644 --- a/support/systemd/nextepc-hssd.service.in +++ b/support/systemd/nextepc-hssd.service.in @@ -1,5 +1,6 @@ [Unit] Description=NextEPC HSS Daemon +BindTo=mongodb.service After=networking.service mongodb.service [Service] @@ -12,7 +13,6 @@ RuntimeDirectory=nextepc-hssd PIDFile=@LIB_DIR@/run/nextepc-hssd/pid Restart=always -ExecStartPre=/bin/sleep 5 ExecStart=@BIN_DIR@/nextepc-hssd -f @SYSCONF_DIR@/nextepc/hss.conf RestartSec=2 RestartPreventExitStatus=1 diff --git a/support/systemd/nextepc-pcrfd.service.in b/support/systemd/nextepc-pcrfd.service.in index 87b5a59c8..ff0cdd75a 100644 --- a/support/systemd/nextepc-pcrfd.service.in +++ b/support/systemd/nextepc-pcrfd.service.in @@ -1,5 +1,6 @@ [Unit] Description=NextEPC PCRF Daemon +BindTo=mongodb.service After=networking.service mongodb.service [Service] @@ -12,7 +13,6 @@ RuntimeDirectory=nextepc-pcrfd PIDFile=@LIB_DIR@/run/nextepc-pcrfd/pid Restart=always -ExecStartPre=/bin/sleep 5 ExecStart=@BIN_DIR@/nextepc-pcrfd -f @SYSCONF_DIR@/nextepc/pcrf.conf RestartSec=2 RestartPreventExitStatus=1