[PATCH] Fix for kannel-monitor

"Angel Fradejas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi all,
 
Attached a patch to fix broken functionality (caused by fread()'s bad
behaviour) in kannel-monitor script.
 
We have observed that with only one call to fread($buffer,200000), the
script does not receive the entire xml status document, for documents bigger
than 10K aproximately. It only receives something in the 2000-5000 bytes
range.
 
So the symthom is that the smsc links summary says, for example, 48 total
links, only 5 online, and 0 disconnected/connecting/reconnecting.
 
I have confirmed this behaviour both with Apache/2.0.45 PHP/4.3.3 and
Apache/1.3.27 PHP/4.3.3 combinations.
 
This patch has a safer way to be sure to read the entire xml document, as
feof() seems to be more reliable than fread() alone.
 
Cheers.
 
Angel Fradejas
Mediafusión España, S.A.
[email protected]
www.mediafusion.es
Tel +34 91 252 32 00
Fax +34 91 252 59 69
kannel-monitor.patch (application/octet-stream, 673 B)
Index: contrib/kannel-monitor/index.php
===================================================================
RCS file: /home/cvs/gateway/contrib/kannel-monitor/index.php,v
retrieving revision 1.5
diff -u -r1.5 index.php
--- contrib/kannel-monitor/index.php	7 Nov 2003 12:37:29 -0000	1.5
+++ contrib/kannel-monitor/index.php	18 Dec 2003 12:22:36 -0000
@@ -111,7 +111,10 @@
         }     
         
         /* read the XML input */
-        $status[$inst] = fread($fp, 200000);
+        $status[$inst] = "";
+        while (!feof($fp)) {  
+            $status[$inst] .= fread($fp, 200000);
+        }
         fclose($fp);
 
         /* get the status of this bearerbox */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.