diff --git a/src/httpc.c b/src/httpc.c index 65d6ac7..ca1db05 100644 --- a/src/httpc.c +++ b/src/httpc.c @@ -569,6 +569,7 @@ skip: http_client_direction(hc, 1); return HTTP_CON_SENDING; } + return http_client_flush(hc, -errno); } wcmd->wpos += r; @@ -696,6 +697,7 @@ http_client_finish( http_client_t *hc ) res = hc->hc_rtp_data_complete(hc); pthread_mutex_lock(&hc->hc_mutex); http_client_put(hc); + tvhtrace(LS_HTTPC, "here %d", res); if (res < 0) return http_client_flush(hc, res); } else if (hc->hc_data_complete) { @@ -704,6 +706,7 @@ http_client_finish( http_client_t *hc ) res = hc->hc_data_complete(hc); pthread_mutex_lock(&hc->hc_mutex); http_client_put(hc); + tvhtrace(LS_HTTPC, "here2 %d", res); if (res < 0) return http_client_flush(hc, res); } @@ -1004,6 +1007,7 @@ retry: if (hc->hc_in_data && !hc->hc_in_rtp_data) { res = http_client_data_received(hc, buf, r, 0); + tvhtrace(LS_HTTPC, "here3 %d", res); if (res < 0) return http_client_flush(hc, res); if (res > 0) { @@ -1019,7 +1023,11 @@ retry: if (hc->hc_rsize < r + hc->hc_rpos) { if (hc->hc_rsize + r > hc->hc_io_size + 20*1024) +{ + tvhtrace(LS_HTTPC, "here4 -> %zd %zd %zd ", hc->hc_rsize, r,hc->hc_io_size); + tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, hc->hc_rsize); return http_client_flush(hc, -EMSGSIZE); +} hc->hc_rsize += r; hc->hc_rbuf = realloc(hc->hc_rbuf, hc->hc_rsize + 1); } @@ -1132,6 +1140,8 @@ rtsp_data: hc->hc_in_rtp_data = 0; while (hc->hc_rpos > r + 3) { hc->hc_csize = 4 + ((hc->hc_rbuf[r+2] << 8) | hc->hc_rbuf[r+3]); + int seq = (hc->hc_rbuf[r+6] << 8) | hc->hc_rbuf[r+7]; + tvhtrace(LS_HTTPC, "here5 %X: hc size %zd seq %d, left %ld", shortid(hc), hc->hc_csize, seq,hc->hc_rpos - r); hc->hc_chunked = 0; if (r + hc->hc_csize > hc->hc_rpos) { memmove(hc->hc_rbuf, hc->hc_rbuf + r, hc->hc_rpos - r); diff --git a/src/tvhlog.c b/src/tvhlog.c index f483bbf..88cdcf2 100644 --- a/src/tvhlog.c +++ b/src/tvhlog.c @@ -464,11 +464,11 @@ void _tvhlog_hexdump(const char *file, int line, int severity, int subsys, const uint8_t *data, ssize_t len ) { - int i, c; + int i, c, x = 0; char str[1024]; /* Assume that severify was validated before call */ - + tvhlogv(file, line, severity, subsys, "start ", NULL); /* Build and log output */ while (len > 0) { c = 0; @@ -489,6 +489,8 @@ _tvhlog_hexdump(const char *file, int line, int severity, c++; } str[c] = '\0'; + sprintf(str +strlen(str)," -> %04X", x); + x += 16; tvhlogv(file, line, severity, subsys, str, NULL); len -= HEXDUMP_WIDTH; data += HEXDUMP_WIDTH;