From: Matteo Nastasi (mop) Date: Wed, 24 Oct 2012 05:32:36 +0000 (+0200) Subject: improved fread return value management X-Git-Tag: v4.0.0~33 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=5270f051ec92e4db7a68de1ec21e15172c2d6e8c;p=brisk.git improved fread return value management --- diff --git a/web/Obj/sac-a-push.phh b/web/Obj/sac-a-push.phh index 8f0dbc3..8da22fd 100644 --- a/web/Obj/sac-a-push.phh +++ b/web/Obj/sac-a-push.phh @@ -368,10 +368,11 @@ class Sac_a_push { } } else { - if (($buf = fread($sock, 512)) === FALSE) { - printf("error read\n"); - } - else if (strlen($buf) === 0) { + $buf = fread($sock, 512); + if ($buf == FALSE || strlen($buf) == 0) { + if ($buf == FALSE) { + printf("ERROR READING\n"); + } if ($sock === $this->list) { printf("Arrivati %d bytes da list\n", strlen($buf)); } @@ -385,9 +386,10 @@ class Sac_a_push { } unset($this->socks[intval($sock)]); unset($this->s2u[intval($sock)]); - fclose($sock); - printf("CLOSE ON READ\n"); } + fclose($sock); + printf("CLOSE ON READ\n"); + if ($this->debug > 1) { printf("post unset\n"); print_r($this->socks);