diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-07-05 11:01:07 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-07-05 11:01:07 -0400 |
commit | 23e6dafff6d82492aa7ab2addc2fae99bd609b57 (patch) | |
tree | 04d1d29986af1d0d68cedfcd1984ba627e26a3b1 | |
parent | cb019f7aad9c4a618316fb3c2e4a36bc013c8da3 (diff) |
better handling of frames and notices
-rw-r--r-- | lib/stompqueuemanager.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/stompqueuemanager.php b/lib/stompqueuemanager.php index 5f0b88d8a..e7e1e00dd 100644 --- a/lib/stompqueuemanager.php +++ b/lib/stompqueuemanager.php @@ -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); |