Ver código fonte

patches: rebase network-timeout patch against current HEAD

Gleb Pinigin 12 anos atrás
pai
commit
cf91af8dda

+ 25 - 27
patches/0015-io-implement-network-timeout-default-60s.patch

@@ -1,14 +1,14 @@
-From baf0d1cd5a92aae1e22e11abcb38777b688ea993 Mon Sep 17 00:00:00 2001
+From 55b98dedd7f2c5b7703f66dd5409f5e16ff99215 Mon Sep 17 00:00:00 2001
 From: Gleb Pinigin <gpinigin@gmail.com>
 Date: Sun, 28 Jul 2013 18:32:51 +0700
-Subject: [PATCH 15/16] io: implement network timeout(default 60s)
+Subject: [PATCH 14/16] io: implement network timeout(default 60s)
 
 ---
  src/network/io.c | 15 ++++++++++++++-
  1 file changed, 14 insertions(+), 1 deletion(-)
 
 diff --git a/src/network/io.c b/src/network/io.c
-index 9b13b2a..f625dd4 100644
+index 21bf82b..a062b72 100644
 --- a/src/network/io.c
 +++ b/src/network/io.c
 @@ -33,6 +33,7 @@
@@ -19,7 +19,7 @@ index 9b13b2a..f625dd4 100644
  
  #include <stdlib.h>
  #include <stdio.h>
-@@ -69,6 +70,9 @@
+@@ -73,6 +74,9 @@
  # define SOL_DCCP 269
  #endif
  
@@ -29,7 +29,7 @@ index 9b13b2a..f625dd4 100644
  #include "libvlc.h" /* vlc_object_waitpipe */
  
  extern int rootwrap_bind (int family, int socktype, int protocol,
-@@ -263,6 +267,7 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
+@@ -267,6 +271,7 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
      ufd[1].fd = vlc_object_waitpipe (p_this);
      ufd[1].events = POLLIN;
  
@@ -37,33 +37,31 @@ index 9b13b2a..f625dd4 100644
      size_t i_total = 0;
      do
      {
-@@ -291,6 +296,12 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
-                 case EWOULDBLOCK:
- #endif
-                 case EINTR:  /* asynchronous signal */
-+                    if (i_timepassed >= MAX_TIMEOUT && i_total == 0)
-+                    {
-+                        access_t *p_access = (access_t *)p_this;
-+                        p_access->info.b_eof = true;
-+                        goto error;
-+                    }
-                     break;
- #ifdef _WIN32
-                 case WSAEMSGSIZE: /* datagram too big */
-@@ -320,10 +331,12 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
-             errno = EINTR;
+@@ -288,6 +293,13 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
+
+         if (n < 0)
+         {
++            if (i_timepassed >= MAX_TIMEOUT && i_total == 0)
++            {
++                access_t *p_access = (access_t *)p_this;
++                p_access->info.b_eof = true;
++                goto error;
++            }
++
+             switch (net_errno)
+             {
+                 case EAGAIN: /* no data */
+@@ -326,8 +338,9 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
              return -1;
          }
--        while (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), -1) < 0)
-+        while (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), POLL_TIMEOUT) < 0)
-             if (errno != EINTR)
-                 goto error;
  
 +        i_timepassed += POLL_TIMEOUT;
-+
-         if (ufd[1].revents)
+         /* Wait for more data */
+-        if (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), -1) < 0)
++        if (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), POLL_TIMEOUT) < 0)
          {
-             msg_Dbg (p_this, "socket %d polling interrupted", fd);
+             if (errno == EINTR)
+                 continue;
 -- 
 1.7.12.4 (Apple Git-37)