]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
satip client: show the proper connection state in 'RTSP cmd error' log message
authorJaroslav Kysela <perex@perex.cz>
Thu, 29 Nov 2018 13:41:56 +0000 (14:41 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 30 Nov 2018 07:47:29 +0000 (08:47 +0100)
src/http.h
src/httpc.c
src/input/mpegts/satip/satip_frontend.c

index f338dcc033d9717ef5d6d9a8effc5e1cefafa0db..40c36f1ccbb5a1eb0e29ac6cc499230d0f87e35e 100644 (file)
@@ -436,6 +436,8 @@ struct http_client {
 void http_client_init ( void );
 void http_client_done ( void );
 
+const char * http_client_con2str(http_state_t state);
+
 http_client_t*
 http_client_connect ( void *aux, http_ver_t ver, const char *scheme,
                       const char *host, int port, const char *bindaddr );
index 8d214bba6f1cfb87c3ecdff695c5c6b881babaa4..6cb4798cc66c61b68b1465d6b4532042351cfaa4 100644 (file)
@@ -120,6 +120,25 @@ http_client_busy( http_client_t *hc )
   return !!hc->hc_refcnt;
 }
 
+static struct strtab HTTP_statetab[] = {
+  { "WAIT_REQUEST",  HTTP_CON_WAIT_REQUEST },
+  { "READ_HEADER",   HTTP_CON_READ_HEADER },
+  { "END",           HTTP_CON_END },
+  { "POST_DATA",     HTTP_CON_POST_DATA },
+  { "SENDING",       HTTP_CON_SENDING },
+  { "SENT",          HTTP_CON_SENT },
+  { "RECEIVING",     HTTP_CON_RECEIVING },
+  { "DONE",          HTTP_CON_DONE },
+  { "IDLE",          HTTP_CON_IDLE },
+  { "OK",            HTTP_CON_OK }
+};
+
+const char *
+http_client_con2str(http_state_t val)
+{
+  return val2str(val, HTTP_statetab);
+}
+
 /*
  *
  */
@@ -1744,17 +1763,6 @@ http_client_testsuite_data_received( http_client_t *hc, void *data, size_t len )
   return 0;
 }
 
-static struct strtab HTTP_contab[] = {
-  { "WAIT_REQUEST", HTTP_CON_WAIT_REQUEST },
-  { "READ_HEADER",  HTTP_CON_READ_HEADER },
-  { "END",          HTTP_CON_END },
-  { "POST_DATA",    HTTP_CON_POST_DATA },
-  { "SENDING",      HTTP_CON_SENDING },
-  { "SENT",         HTTP_CON_SENT },
-  { "RECEIVING",    HTTP_CON_RECEIVING },
-  { "DONE",         HTTP_CON_DONE },
-};
-
 static struct strtab ERRNO_tab[] = {
   { "EPERM",           EPERM },
   { "ENOENT",          ENOENT },
@@ -1975,7 +1983,7 @@ http_client_testsuite_run( void )
     } else if (strncmp(s, "Port=", 5) == 0) {
       port = atoi(s + 5);
     } else if (strncmp(s, "ExpectedError=", 14) == 0) {
-      r = str2val(s + 14, HTTP_contab);
+      r = str2val(s + 14, HTTP_statetab);
       if (r < 0) {
         r = str2val(s + 14, ERRNO_tab);
         if (r < 0) {
index 1ab245c4c200c91b615985c547cbedbacb04d9d2..a87b202343dc2aa46f830f4e7886ef553503beaf 100644 (file)
@@ -2035,7 +2035,8 @@ new_tune:
         default:
           if (rtsp->hc_code >= 400) {
             tvherror(LS_SATIP, "%s - RTSP cmd error %d (%s) [%i-%i]",
-                     buf, r, strerror(-r), rtsp->hc_cmd, rtsp->hc_code);
+                     buf, r, r > 0 ? http_client_con2str(r) : strerror(-r),
+                     rtsp->hc_cmd, rtsp->hc_code);
             satip_frontend_tuning_error(lfe, tr);
             fatal = 1;
           }