* Initialisation / Shutdown / Saving
* *************************************************************************/
+static int config_newcfg = 0;
+
void
-config_init ( const char *path, int backup )
+config_boot ( const char *path )
{
struct stat st;
char buf[1024];
const char *homedir = getenv("HOME");
- int new = 0;
/* Generate default */
if (!path) {
/* Ensure directory exists */
if (stat(path, &st)) {
- new = 1;
+ config_newcfg = 1;
if (makedirs(path, 0700)) {
tvhwarn("START", "failed to create settings directory %s,"
" settings will not be saved", path);
tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults");
config = htsmsg_create_map();
}
+}
+void
+config_init ( int backup )
+{
/* Store version number */
- if (new) {
+ if (config_newcfg) {
htsmsg_set_u32(config, "version", ARRAY_SIZE(config_migrate_table));
htsmsg_set_str(config, "fullversion", tvheadend_version);
config_save();
if (config_migrate(backup))
config_check();
}
+ tvhinfo("config", "loaded");
}
void config_done ( void )
#include "htsmsg.h"
-void config_init ( const char *path, int backup );
+void config_boot ( const char *path );
+void config_init ( int backup );
void config_done ( void );
void config_save ( void );
signal(SIGILL, handle_sigill); // see handler..
uuid_init();
+ config_boot(opt_config);
tcp_server_preinit(opt_ipv6);
http_server_init(opt_bindaddr); // bind to ports only
htsp_init(opt_bindaddr); // bind to ports only
/* Initialise configuration */
idnode_init();
spawn_init();
- config_init(opt_config, opt_nobackup == 0);
+ config_init(opt_nobackup == 0);
/**
* Initialize subsystems
rtsp_close_sessions();
pthread_mutex_unlock(&rtsp_lock);
tcp_server_delete(rtsp_server);
+ rtsp_server = NULL;
reg = 1;
}
free(rtsp_ip);
rtsp_ip = strdup(bindaddr);
rtsp_port = port;
- rtsp_server = tcp_server_create(bindaddr, port, &ops, NULL);
+ if (!rtsp_server)
+ rtsp_server = tcp_server_create(bindaddr, port, &ops, NULL);
if (reg)
tcp_server_register(rtsp_server);
}
if(x != 0)
{
- tvhlog(LOG_ERR, "tcp", "bind: %s: %s", bindaddr != NULL ? bindaddr : "*", strerror(errno));
+ tvhlog(LOG_ERR, "tcp", "bind: %s:%i: %s", bindaddr != NULL ? bindaddr : "*", port, strerror(errno));
close(fd);
return NULL;
}
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbt")))
ssave |= config_set_int("satip_dvbt", atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbs")))
- ssave |= config_set_int("satip_dvbt", atoi(str));
+ ssave |= config_set_int("satip_dvbs", atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbc")))
- ssave |= config_set_int("satip_dvbt", atoi(str));
+ ssave |= config_set_int("satip_dvbc", atoi(str));
if (save | ssave)
config_save();
if (ssave)
fieldLabel: 'Exported DVB-T Tuners'
});
var dvbs = new Ext.form.NumberField({
- name: 'satip_dvbt',
+ name: 'satip_dvbs',
fieldLabel: 'Exported DVB-S2 Tuners'
});
var dvbc = new Ext.form.NumberField({
- name: 'satip_dvbt',
+ name: 'satip_dvbc',
fieldLabel: 'Exported DVB-C Tuners'
});
satipPanel = new Ext.form.FieldSet({