$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;
}
}
}
function sendMessageInsecure($data)
{
- $returned = $this->sendMessageInternal(serialize($data), $this->socket);
+ $this->sendMessageInternal(serialize($data), $this->socket);
+ $returned = $this->receiveMessageInternal($this->socket);
return unserialize($returned);
}
$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
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)
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;