Project

General

Profile

Bug #4353 » diff.txt

catalin toda, 2017-07-21 07:29

 
1
diff --git a/src/httpc.c b/src/httpc.c
2
index 65d6ac7..ca1db05 100644
3
--- a/src/httpc.c
4
+++ b/src/httpc.c
5
@@ -569,6 +569,7 @@ skip:
6
         http_client_direction(hc, 1);
7
         return HTTP_CON_SENDING;
8
       }
9
+          
10
       return http_client_flush(hc, -errno);
11
     }
12
     wcmd->wpos += r;
13
@@ -696,6 +697,7 @@ http_client_finish( http_client_t *hc )
14
     res = hc->hc_rtp_data_complete(hc);
15
     pthread_mutex_lock(&hc->hc_mutex);
16
     http_client_put(hc);
17
+    tvhtrace(LS_HTTPC, "here %d", res);
18
     if (res < 0)
19
       return http_client_flush(hc, res);
20
   } else if (hc->hc_data_complete) {
21
@@ -704,6 +706,7 @@ http_client_finish( http_client_t *hc )
22
     res = hc->hc_data_complete(hc);
23
     pthread_mutex_lock(&hc->hc_mutex);
24
     http_client_put(hc);
25
+    tvhtrace(LS_HTTPC, "here2 %d", res);
26
     if (res < 0)
27
       return http_client_flush(hc, res);
28
   }
29
@@ -1004,6 +1007,7 @@ retry:
30
 
31
   if (hc->hc_in_data && !hc->hc_in_rtp_data) {
32
     res = http_client_data_received(hc, buf, r, 0);
33
+    tvhtrace(LS_HTTPC, "here3 %d", res);
34
     if (res < 0)
35
       return http_client_flush(hc, res);
36
     if (res > 0) {
37
@@ -1019,7 +1023,11 @@ retry:
38
 
39
   if (hc->hc_rsize < r + hc->hc_rpos) {
40
     if (hc->hc_rsize + r > hc->hc_io_size + 20*1024)
41
+{
42
+	tvhtrace(LS_HTTPC, "here4 -> %zd %zd %zd ", hc->hc_rsize, r,hc->hc_io_size);
43
+	tvhlog_hexdump(LS_HTTPC, hc->hc_rbuf, hc->hc_rsize);
44
       return http_client_flush(hc, -EMSGSIZE);
45
+}
46
     hc->hc_rsize += r;
47
     hc->hc_rbuf = realloc(hc->hc_rbuf, hc->hc_rsize + 1);
48
   }
49
@@ -1132,6 +1140,8 @@ rtsp_data:
50
   hc->hc_in_rtp_data = 0;
51
   while (hc->hc_rpos > r + 3) {
52
     hc->hc_csize = 4 + ((hc->hc_rbuf[r+2] << 8) | hc->hc_rbuf[r+3]);
53
+    int seq = (hc->hc_rbuf[r+6] << 8) | hc->hc_rbuf[r+7];
54
+    tvhtrace(LS_HTTPC, "here5 %X: hc size %zd seq %d, left %ld", shortid(hc), hc->hc_csize, seq,hc->hc_rpos - r);
55
     hc->hc_chunked = 0;
56
     if (r + hc->hc_csize > hc->hc_rpos) {
57
       memmove(hc->hc_rbuf, hc->hc_rbuf + r, hc->hc_rpos - r);
58
diff --git a/src/tvhlog.c b/src/tvhlog.c
59
index f483bbf..88cdcf2 100644
60
--- a/src/tvhlog.c
61
+++ b/src/tvhlog.c
62
@@ -464,11 +464,11 @@ void
63
 _tvhlog_hexdump(const char *file, int line, int severity,
64
                 int subsys, const uint8_t *data, ssize_t len )
65
 {
66
-  int i, c;
67
+  int i, c, x = 0;
68
   char str[1024];
69
 
70
   /* Assume that severify was validated before call */
71
-
72
+	tvhlogv(file, line, severity, subsys, "start ", NULL);
73
   /* Build and log output */
74
   while (len > 0) {
75
     c = 0;
76
@@ -489,6 +489,8 @@ _tvhlog_hexdump(const char *file, int line, int severity,
77
       c++;
78
     }
79
     str[c] = '\0';
80
+    sprintf(str +strlen(str),"   -> %04X", x);
81
+    x += 16;
82
     tvhlogv(file, line, severity, subsys, str, NULL);
83
     len  -= HEXDUMP_WIDTH;
84
     data += HEXDUMP_WIDTH;
(1-1/2)