diff --git a/src/config.c b/src/config.c index 9eac90ec..abe5ba6a 100644 --- a/src/config.c +++ b/src/config.c @@ -1360,13 +1360,14 @@ config_check ( void ) * 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) { @@ -1376,7 +1377,7 @@ config_init ( const char *path, int backup ) /* 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); @@ -1407,9 +1408,13 @@ config_init ( const char *path, int backup ) 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(); @@ -1419,6 +1424,7 @@ config_init ( const char *path, int backup ) if (config_migrate(backup)) config_check(); } + tvhinfo("config", "loaded"); } void config_done ( void ) diff --git a/src/config.h b/src/config.h index d9176e2d..659ae777 100644 --- a/src/config.h +++ b/src/config.h @@ -23,7 +23,8 @@ #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 ); diff --git a/src/main.c b/src/main.c index 6c21e192..1fc808b9 100644 --- a/src/main.c +++ b/src/main.c @@ -709,6 +709,7 @@ main(int argc, char **argv) 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 @@ -817,7 +818,7 @@ main(int argc, char **argv) /* Initialise configuration */ idnode_init(); spawn_init(); - config_init(opt_config, opt_nobackup == 0); + config_init(opt_nobackup == 0); /** * Initialize subsystems diff --git a/src/satip/rtsp.c b/src/satip/rtsp.c index a6b82173..e275a1a7 100644 --- a/src/satip/rtsp.c +++ b/src/satip/rtsp.c @@ -1029,12 +1029,14 @@ void satip_server_rtsp_init(const char *bindaddr, int port) 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); } diff --git a/src/tcp.c b/src/tcp.c index 18c971d8..12dc8a95 100644 --- a/src/tcp.c +++ b/src/tcp.c @@ -695,7 +695,7 @@ tcp_server_create 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; } diff --git a/src/webui/extjs.c b/src/webui/extjs.c index fc2e04c1..9414d9d7 100644 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -532,9 +532,9 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque) 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) diff --git a/src/webui/static/app/config.js b/src/webui/static/app/config.js index 71d05606..2bdd794f 100644 --- a/src/webui/static/app/config.js +++ b/src/webui/static/app/config.js @@ -234,11 +234,11 @@ tvheadend.miscconf = function(panel, index) { 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({