configs and comms
authorpaulr <me@pjr.cc>
Mon, 19 Sep 2011 18:35:29 +0000 (04:35 +1000)
committerpaulr <me@pjr.cc>
Mon, 19 Sep 2011 18:35:29 +0000 (04:35 +1000)
bin/cbfwrd.php
libcbfwr/comms.php
unittests/readconfigfromshm.php

index b5a91b3..3b29870 100644 (file)
@@ -32,6 +32,10 @@ while($cont) {
        
        $comms->putConfig($config->getConfig());
        
+       $msg = $comms->waitForMessage();
+       
+       //echo "Got message: $msg\n";
+       
        $cont = false;
 }
 ?>
\ No newline at end of file
index b1195c9..db0215e 100644 (file)
@@ -37,11 +37,18 @@ class Comms {
        
        function waitForMessage()
        {
+               global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY;
+               $queue = msg_get_queue($MESSAGE_KEY);
+               msg_receive($queue, 0, $msgtype, 1024, $msg);
                
+               return $msg;
        }
        
-       function sendMessage()
+       function sendMessage($msg)
        {
+               global $MESSAGE_KEY, $LOCKING_KEY, $STORE_KEY;
+               $queue = msg_get_queue($MESSAGE_KEY);
+               msg_send($queue, 1, $msg);
                
        }
        
index f05849b..1c1247c 100644 (file)
@@ -23,4 +23,6 @@ $conf = $comms->getConfig();
 
 print_r($conf);
 
+$comms->sendMessage("hi there");
+
 ?>
\ No newline at end of file