struct GNUNET_SERVICE_Context *sctx = cls;
unsigned int i;
+ if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
+ return;
GNUNET_RESOLVER_connect (sctx->cfg);
if (NULL != sctx->lsocks)
sctx->server =
#define HANDLE_ERROR do { GNUNET_break (0); goto shutdown; } while (0)
int err;
+ int ret;
char *cfg_fn;
char *loglev;
char *logfile;
GNUNET_GETOPT_OPTION_HELP (NULL),
GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev),
GNUNET_GETOPT_OPTION_LOGFILE (&logfile),
- GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION),
+ GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION),
GNUNET_GETOPT_OPTION_END
};
err = 1;
sctx.task_cls = task_cls;
sctx.service_name = service_name;
sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
+
/* setup subsystems */
- if (GNUNET_SYSERR ==
- GNUNET_GETOPT_run (service_name, service_options, argc, argv))
+ ret = GNUNET_GETOPT_run (service_name, service_options, argc, argv);
+ if (GNUNET_SYSERR == ret)
+ goto shutdown;
+ if (GNUNET_NO == ret)
+ {
+ err = 0;
goto shutdown;
+ }
if (GNUNET_OK != GNUNET_log_setup (service_name, loglev, logfile))
HANDLE_ERROR;
- if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfg_fn))
- goto shutdown;
+ if (GNUNET_YES ==
+ GNUNET_DISK_file_test (cfg_fn))
+ (void) GNUNET_CONFIGURATION_load (cfg, cfg_fn);
+ else
+ {
+ (void) GNUNET_CONFIGURATION_load (cfg, NULL);
+ if (0 != strcmp (cfg_fn, GNUNET_DEFAULT_USER_CONFIG_FILE))
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _("Could not access configuration file `%s'\n"),
+ cfg_fn);
+ }
if (GNUNET_OK != setup_service (&sctx))
goto shutdown;
if ((1 == do_daemonize) && (GNUNET_OK != detach_terminal (&sctx)))