From: Jaroslav Kysela Date: Thu, 29 Nov 2018 13:41:56 +0000 (+0100) Subject: satip client: show the proper connection state in 'RTSP cmd error' log message X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ae5399c0b04df03bdc4f9468ff66bcc83642cfe;p=thirdparty%2Ftvheadend.git satip client: show the proper connection state in 'RTSP cmd error' log message --- diff --git a/src/http.h b/src/http.h index f338dcc03..40c36f1cc 100644 --- a/src/http.h +++ b/src/http.h @@ -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 ); diff --git a/src/httpc.c b/src/httpc.c index 8d214bba6..6cb4798cc 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -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) { diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index 1ab245c4c..a87b20234 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -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; }