*** empty log message ***
authorArt Cancro <ajc@citadel.org>
Tue, 25 Nov 2003 03:32:53 +0000 (03:32 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 25 Nov 2003 03:32:53 +0000 (03:32 +0000)
ctdlphp/ctdlprotocol.php
ctdlphp/sessionproxy.php

index a104d03bbbaea174efe626da4d3d6e8723baf1d2..52e09f7c1da2c333c2c5968ec91440cdd4c1d394 100644 (file)
@@ -43,7 +43,7 @@ function text_to_server($thetext, $convert_to_html) {
 
        $this_line = strtok($thetext, "\n");
 
-       while ($this_line) {
+       while ($this_line !== FALSE) {
                $this_line = trim($this_line, "\n\r");
                if ($this_line == "000") $this_line = "-000" ;
                serv_puts($this_line);
index 0ace0b57e037e02f074f9d4ee2475962e135e847..75bd902438306cc0160626bc4d1a35bf86546fee 100755 (executable)
@@ -18,8 +18,9 @@
 // sock_gets() -- reads one line of text from a socket
 // 
 function sock_gets($sock) {
+       socket_clear_error($msgsock);
        $buf = socket_read($sock, 4096, PHP_NORMAL_READ);
-       if ($buf == false) return false;
+       if (socket_last_error($buf)) return false;
 
        if (preg_match("'\n$'s", $buf)) {
                $buf = substr($buf, 0, strpos($buf, "\n"));
@@ -157,8 +158,9 @@ do {
 
                        // SEND_LISTING mode
                        if (substr($talkback, 0, 1) == "4") do {
+                               socket_clear_error($msgsock);
                                $buf = sock_gets($msgsock);
-                               if (!$buf) {
+                               if (socket_last_error($msgsock)) {
                                        $buf = "000" ;
                                }
                                if (!fwrite($ctdlsock, $buf . "\n")) {