]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
SAT>IP server: fix the tuner configuration
authorJaroslav Kysela <perex@perex.cz>
Tue, 10 Mar 2015 13:37:46 +0000 (14:37 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:13 +0000 (21:41 +0100)
src/config.c
src/config.h
src/main.c
src/satip/rtsp.c
src/tcp.c
src/webui/extjs.c
src/webui/static/app/config.js

index 9eac90ecd747c42301a36441191ebed28b2afabc..abe5ba6aa1c4bad604d0ff5545d7388a7f871d6d 100644 (file)
@@ -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 )
index d9176e2d9a36618b3d0f9c71c56caa2010b5b818..659ae777c5f18b23c94a516a584753acd2c2f7a7 100644 (file)
@@ -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 );
 
index 6c21e192ad3fee1ca08c0b14228811341007678e..1fc808b95d1304eefeff0531e3776598b3d08bc5 100644 (file)
@@ -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
index a6b821733edad21a6c917e8118c8b2c8b6f92037..e275a1a74d8f52b73c3317038858b208418e8284 100644 (file)
@@ -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);
 }
index 18c971d8b096470d3e4b1c80f39885bcea4c9cc3..12dc8a95034f04f6b19781cc42c09e1552ddfffb 100644 (file)
--- 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;
   }
index fc2e04c10cfc7f09bacffb0aa72a956b9146db4f..9414d9d7f3d0fafcd656af8d748f632f0c871e7c 100644 (file)
@@ -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)
index 71d05606a2bbbeb2b1a339301fa3c65c9edf3ebe..2bdd794fa90cf07b3097f8bac406e3d3f23f99d2 100644 (file)
@@ -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({