Browse Source

patches: rebase network timeout patch against current HEAD

Gleb Pinigin 12 years ago
parent
commit
620a2c3268

+ 29 - 31
patches/disabled/0010-MINOR-implement-network-timeout-default-60s.patch

@@ -1,14 +1,14 @@
-From 0b816ffc8447a88cac3dd99e7a576637f96692a9 Mon Sep 17 00:00:00 2001
+From c447793b7e9340841e178536ccefcb7dfddcd941 Mon Sep 17 00:00:00 2001
 From: Gleb Pinigin <gpinigin@gmail.com>
 From: Gleb Pinigin <gpinigin@gmail.com>
-Date: Mon, 25 Mar 2013 11:09:33 +0700
-Subject: [PATCH 4/4] MINOR implement network timeout(default 60s)
+Date: Sun, 28 Jul 2013 18:32:51 +0700
+Subject: [PATCH 14/14] io: implement network timeout(default 60s)
 
 
 ---
 ---
- src/network/io.c | 19 +++++++++++++++++--
- 1 file changed, 17 insertions(+), 2 deletions(-)
+ src/network/io.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
 
 
 diff --git a/src/network/io.c b/src/network/io.c
 diff --git a/src/network/io.c b/src/network/io.c
-index 7cc9764..16ea48c 100644
+index 9b13b2a..f625dd4 100644
 --- a/src/network/io.c
 --- a/src/network/io.c
 +++ b/src/network/io.c
 +++ b/src/network/io.c
 @@ -33,6 +33,7 @@
 @@ -33,6 +33,7 @@
@@ -29,43 +29,41 @@ index 7cc9764..16ea48c 100644
  #include "libvlc.h" /* vlc_object_waitpipe */
  #include "libvlc.h" /* vlc_object_waitpipe */
  
  
  extern int rootwrap_bind (int family, int socktype, int protocol,
  extern int rootwrap_bind (int family, int socktype, int protocol,
-@@ -265,15 +269,19 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
-     if (ufd[1].fd == -1)
-         return -1; /* vlc_object_waitpipe() sets errno */
+@@ -263,6 +267,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;
  
  
 +    int i_timepassed = 0;
 +    int i_timepassed = 0;
-+
-     while (i_buflen > 0)
+     size_t i_total = 0;
+     do
      {
      {
--        if (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), -1) < 0)
-+        if (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), POLL_TIMEOUT) < 0)
-         {
-             if (errno != EINTR)
-                 goto error;
-             continue;
-         }
- 
-+        i_timepassed += POLL_TIMEOUT;
-+
-         if (i_total > 0)
-         {
-             /* Errors (-1) and EOF (0) will be returned on next call,
-@@ -357,7 +365,14 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
+@@ -291,6 +296,12 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
                  case EWOULDBLOCK:
                  case EWOULDBLOCK:
  #endif
  #endif
                  case EINTR:  /* asynchronous signal */
                  case EINTR:  /* asynchronous signal */
--                    continue;
 +                    if (i_timepassed >= MAX_TIMEOUT && i_total == 0)
 +                    if (i_timepassed >= MAX_TIMEOUT && i_total == 0)
 +                    {
 +                    {
 +                        access_t *p_access = (access_t *)p_this;
 +                        access_t *p_access = (access_t *)p_this;
 +                        p_access->info.b_eof = true;
 +                        p_access->info.b_eof = true;
 +                        goto error;
 +                        goto error;
 +                    }
 +                    }
-+                    else
-+                        continue;
-             }
- #endif
-             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;
+             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)
+         {
+             msg_Dbg (p_this, "socket %d polling interrupted", fd);
 -- 
 -- 
 1.7.12.4 (Apple Git-37)
 1.7.12.4 (Apple Git-37)