From 20d457aab33983f395962b20590c0c6c12669a43 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 18 Feb 2013 06:02:20 +0000 Subject: [PATCH] Try to assert on all virtual recipients --- application/hub/interfaces/recipient/class_Recipient.php | 2 +- application/hub/main/recipient/class_ | 2 ++ application/hub/main/recipient/dht/class_DhtRecipient.php | 4 +++- .../hub/main/recipient/direct/class_DirectRecipient.php | 2 +- application/hub/main/recipient/self/class_SelfRecipient.php | 5 ++++- .../hub/main/recipient/upper/class_UpperRecipient.php | 5 ++++- 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/application/hub/interfaces/recipient/class_Recipient.php b/application/hub/interfaces/recipient/class_Recipient.php index 96e779665..6d77256cc 100644 --- a/application/hub/interfaces/recipient/class_Recipient.php +++ b/application/hub/interfaces/recipient/class_Recipient.php @@ -29,7 +29,7 @@ interface Recipient extends FrameworkInterface { * @param $recipient Recipient to resolve (e.g. could be a virtual recipient or direct session id) * @param $listInstance An instance of a Listable class * @return $resolved Resolved recipient or VOID if only the set list has been filled - * @throws FrameworkException Could throw different exceptions back depending on implementation + * @throws FrameworkException Could throw different exceptions depending on implementation */ function resolveRecipient ($recipient, Listable $listInstance); } diff --git a/application/hub/main/recipient/class_ b/application/hub/main/recipient/class_ index 7669560cf..83d6bf0e0 100644 --- a/application/hub/main/recipient/class_ +++ b/application/hub/main/recipient/class_ @@ -56,6 +56,8 @@ class ???Recipient extends BaseRecipient implements Recipient { * @todo 0% done */ public function resolveRecipient ($recipient, Listable $listInstance) { + // Make sure the recipient is valid + assert($recipient == '|||'); $this->partialStub('Please implement this method. recipient=' . $recipient); } } diff --git a/application/hub/main/recipient/dht/class_DhtRecipient.php b/application/hub/main/recipient/dht/class_DhtRecipient.php index 328de547b..baef26385 100644 --- a/application/hub/main/recipient/dht/class_DhtRecipient.php +++ b/application/hub/main/recipient/dht/class_DhtRecipient.php @@ -52,10 +52,12 @@ class DhtRecipient extends BaseRecipient implements Recipient { * @param $recipient Recipient to resolve (e.g. could be a virtual recipient or direct session id) * @param $listInstance An instance of a Listable class * @return $resolved Resolved recipient or VOID if only the set list has been filled - * @throws FrameworkException Could throw different exceptions back depending on implementation + * @throws FrameworkException Could throw different exceptions depending on implementation * @todo 0% done */ public function resolveRecipient ($recipient, Listable $listInstance) { + // Make sure the recipient is valid + assert($recipient == 'dht'); $this->partialStub('Please implement this method. recipient=' . $recipient); } } diff --git a/application/hub/main/recipient/direct/class_DirectRecipient.php b/application/hub/main/recipient/direct/class_DirectRecipient.php index e3be9d856..1fafba533 100644 --- a/application/hub/main/recipient/direct/class_DirectRecipient.php +++ b/application/hub/main/recipient/direct/class_DirectRecipient.php @@ -52,7 +52,7 @@ class DirectRecipient extends BaseRecipient implements Recipient { * @param $recipient Recipient to resolve (e.g. could be a virtual recipient or direct session id) * @param $listInstance An instance of a Listable class * @return $resolved Resolved recipient or VOID if only the set list has been filled - * @throws FrameworkException Could throw different exceptions back depending on implementation + * @throws FrameworkException Could throw different exceptions depending on implementation */ public function resolveRecipient ($recipient, Listable $listInstance = NULL) { // "Explode" all recipients diff --git a/application/hub/main/recipient/self/class_SelfRecipient.php b/application/hub/main/recipient/self/class_SelfRecipient.php index 5839a2f25..307f29997 100644 --- a/application/hub/main/recipient/self/class_SelfRecipient.php +++ b/application/hub/main/recipient/self/class_SelfRecipient.php @@ -52,9 +52,12 @@ class SelfRecipient extends BaseRecipient implements Recipient { * @param $recipient Recipient to resolve (e.g. could be a virtual recipient or direct session id) * @param $listInstance An instance of a Listable class * @return $resolved Resolved recipient or VOID if only the set list has been filled - * @throws FrameworkException Could throw different exceptions back depending on implementation + * @throws FrameworkException Could throw different exceptions depending on implementation */ public function resolveRecipient ($recipient, Listable $listInstance) { + // Make sure the recipient is valid + assert($recipient == 'self'); + // Determine own port $port = $this->getConfigInstance()->getConfigEntry('node_listen_port'); diff --git a/application/hub/main/recipient/upper/class_UpperRecipient.php b/application/hub/main/recipient/upper/class_UpperRecipient.php index e0cc719c6..408c62609 100644 --- a/application/hub/main/recipient/upper/class_UpperRecipient.php +++ b/application/hub/main/recipient/upper/class_UpperRecipient.php @@ -52,9 +52,12 @@ class UpperRecipient extends BaseRecipient implements Recipient { * @param $recipient Recipient to resolve (e.g. could be a virtual recipient or direct session id) * @param $listInstance An instance of a Listable class * @return $resolved Resolved recipient or VOID if only the set list has been filled - * @throws FrameworkException Could throw different exceptions back depending on implementation + * @throws FrameworkException Could throw different exceptions depending on implementation */ public function resolveRecipient ($recipient, Listable $listInstance) { + // Make sure the recipient is valid + assert($recipient == 'upper'); + // Get all bootstrap nodes foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $ipPort) { // Is maximum reached? -- 2.39.5