parent::__construct(__CLASS__);
// Set handler name
- $this->setHandlerName('message_type_announcement');
+ $this->setHandlerName('message_announcement');
// Init message data array
$this->messageDataElements = array(
* @param $messageData An array with message data to handle
* @param $packageInstance An instance of a Receivable class
* @return void
+ * @throws AnnouncementNotAcceptedException If this node does not accept announcements
*/
public function handleMessageData (array $messageData, Receivable $packageInstance) {
+ // Get node instance
+ $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+ // Is this node accepting announcements?
+ if (!$nodeInstance->isAcceptingAnnouncements()) {
+ /*
+ * This node is not accepting announcements, then someone wants to
+ * announce his node to a non-bootstrap and non-master node.
+ */
+ throw new AnnouncementNotAcceptedException(array($this, $nodeInstance, $messageData), self::EXCEPTION_ANNOUNCEMENT_NOT_ACCEPTED);
+ } // END - if
+
// Register the announcing node with this node
$this->registerNodeByMessageData($messageData);