From 2fe6daea539c94704c1932f546ad01d3bfc5d04c Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sun, 27 Nov 2011 16:59:14 +0100
Subject: [PATCH] suppress errors on stream_select FS#2276

On certain environments, stream_select might produce temporary errors
when file descriptors are running scarce.
---
 inc/HTTPClient.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/inc/HTTPClient.php b/inc/HTTPClient.php
index fdf95d113..641950348 100644
--- a/inc/HTTPClient.php
+++ b/inc/HTTPClient.php
@@ -338,7 +338,10 @@ class HTTPClient {
             }
 
             // wait for stream ready or timeout (1sec)
-            if(stream_select($sel_r,$sel_w,$sel_e,1) === false) continue;
+            if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){
+                usleep(1000);
+                continue;
+            }
 
             // write to stream
             $ret = fwrite($socket, substr($request,$written,4096));
-- 
GitLab