[Icecast-dev] [PATCH 31/31] source: make get_next_buffer try only 10 times and then bail out

Niv Sardi nsardi at smartjog.com
Fri Jul 30 07:54:53 PDT 2010


Signed-off-by: Niv Sardi <nsardi at smartjog.com>
---
 src/source.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/source.c b/src/source.c
index fa99180..796c548 100644
--- a/src/source.c
+++ b/src/source.c
@@ -457,6 +457,7 @@ static refbuf_t *get_next_buffer (source_t *source)
 {
     refbuf_t *refbuf = NULL;
     int delay = 250;
+    int try = 0;
 
     if (source->short_delay)
         delay = 0;
@@ -465,6 +466,11 @@ static refbuf_t *get_next_buffer (source_t *source)
         int fds = 0;
         time_t current = time (NULL);
 
+        if (try++ > 10) {
+            WARN ("Error while waiting on socket (too many trys (%d)), Disconnecting source", try);
+            source->running = 0;
+        }
+
         if (source->client)
             fds = util_timed_wait_for_fd (source->con->sock, delay);
         else
-- 
1.7.1



More information about the Icecast-dev mailing list