X-Git-Url: http://git.pjr.cc/?p=pengine.git;a=blobdiff_plain;f=lib%2FinterComms.php;fp=lib%2FinterComms.php;h=980a5573788be883b43b3da2549aad1996f4daa0;hp=69680ad227861c3cb23b509b6b5ff7d50fb70aea;hb=21578961ae09246c03d308d7e084fcf506f7e9ed;hpb=8208091a0b3112754babdbbf8919bb344dc3180c diff --git a/lib/interComms.php b/lib/interComms.php index 69680ad..980a557 100644 --- a/lib/interComms.php +++ b/lib/interComms.php @@ -161,12 +161,17 @@ class netCom { $continue = true; while($continue) { // wait for a message - $msg = unserialize($this->receiveMessageInternal($socket)); + $msg_s = $this->receiveMessageInternal($socket); + if(!$msg_s) { + echo "Connection handler dieing 1\n"; + return false; + } + $msg = unserialize($msg_s); $retmsg = $callback($msg); $retval = $this->sendMessageInternal(serialize($retmsg), $socket); if(!$retval) { - echo "Connection handler dieing\n"; - $continue = false; + echo "Connection handler dieing 2\n"; + return false; } } } @@ -187,7 +192,8 @@ class netCom { function sendMessageInsecure($data) { - $returned = $this->sendMessageInternal(serialize($data), $this->socket); + $this->sendMessageInternal(serialize($data), $this->socket); + $returned = $this->receiveMessageInternal($this->socket); return unserialize($returned); } @@ -199,7 +205,10 @@ class netCom { $tosend = "PEN:$datacomp:INE"; $retval = socket_send($comsock, $tosend, strlen($tosend), 0); - if(!$retval) return false; + if(!$retval) { + echo "in smi, retval false\n"; + return false; + } echo "end send message $retval\n"; // get up to one meg of data - this is bad... i can feel this function // hurting alot @@ -211,8 +220,10 @@ class netCom { if($recv != "PEN:ACK:INE") { echo "invalid response?\n$recv\n"; } else { - echo "got ack\n"; + echo "smi got ack\n"; } + + return true; } function receiveMessageInternal($comsock) @@ -223,6 +234,10 @@ class netCom { while($continue) { $size = socket_recv($comsock, $recvd_a, 1024, 0); + if($size === false) { + echo "recevie in rmi was false\n"; + return false; + } $recvd .= $recvd_a; echo "got $recvd_a so far for $size\n"; if($size == 0) return false;