tolerate addresses that don't begin with a '/'
This commit is contained in:
parent
d5bd61c35b
commit
7029286883
@ -131,20 +131,24 @@ void Receiver::dispatch(const std::shared_ptr<Message> msg) const
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Receiver::findMethods
|
* @brief Receiver::findMethods
|
||||||
* @param pattern
|
* @param address
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
std::vector<const Method *> Receiver::findMethods(std::string pattern) const
|
std::vector<const Method *> Receiver::findMethods(std::string address) const
|
||||||
{
|
{
|
||||||
std::istringstream stream(pattern);
|
|
||||||
stream.seekg(1); // skip leading '/'
|
|
||||||
|
|
||||||
std::list<std::string> tokens;
|
|
||||||
for (std::string name; std::getline(stream, name, '/');)
|
|
||||||
tokens.push_back(name);
|
|
||||||
|
|
||||||
std::vector<const Method *> hits;
|
std::vector<const Method *> hits;
|
||||||
address_space_->matchAddress(hits, tokens);
|
if (address.empty())
|
||||||
|
return hits;
|
||||||
|
|
||||||
|
std::istringstream stream(address);
|
||||||
|
if (address[0] == '/') // skip leading '/'
|
||||||
|
stream.seekg(1);
|
||||||
|
|
||||||
|
std::list<std::string> pattern;
|
||||||
|
for (std::string name; std::getline(stream, name, '/');)
|
||||||
|
pattern.push_back(name);
|
||||||
|
|
||||||
|
address_space_->matchAddress(hits, pattern);
|
||||||
return hits;
|
return hits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Method *rootMethod() const { return address_space_; }
|
Method *rootMethod() const { return address_space_; }
|
||||||
std::vector<const Method *> findMethods(std::string pattern) const;
|
std::vector<const Method *> findMethods(std::string address) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void scheduleBundle(const std::shared_ptr<Bundle> bundle) const;
|
void scheduleBundle(const std::shared_ptr<Bundle> bundle) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user