]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better handling of frames and notices
authorEvan Prodromou <evan@controlyourself.ca>
Sun, 5 Jul 2009 15:01:07 +0000 (11:01 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Sun, 5 Jul 2009 15:01:07 +0000 (11:01 -0400)
lib/stompqueuemanager.php

index 5f0b88d8ad85e3c82655a94ae86025647bcb390a..e7e1e00dd9743aa82ff4d444306ff39067442b16 100644 (file)
@@ -37,7 +37,6 @@ class StompQueueManager
     var $password = null;
     var $base = null;
     var $con = null;
-    var $frames = array();
 
     function __construct()
     {
@@ -97,13 +96,19 @@ class StompQueueManager
 
             $frame = $this->con->readFrame();
 
-            if ($frame) {
-                $notice = Notice::staticGet($frame->body);
+            if (!empty($frame)) {
+                $notice = Notice::staticGet('id', $frame->body);
 
-                if ($handler->handle_notice($notice)) {
+                if (empty($notice)) {
+                    $this->_log(LOG_WARNING, 'Got ID '. $frame->body .' for non-existent notice');
+                    $this->con->ack($frame);
+                } else if ($handler->handle_notice($notice)) {
                     $this->_log(LOG_INFO, 'Successfully handled notice '. $notice->id .' posted at ' . $frame->headers['created']);
                     $this->con->ack($frame);
+                    unset($notice);
                 }
+
+                unset($frame);
             }
 
             $handler->idle(0);