Example #1
0
NodeRef NodeStore::retrieve(const string &id, bool mustBeNeighbor)
{
        Mutex::AutoLocker l(mutex);

	for (NodeStore::iterator it = begin(); it != end(); it++) {
		NodeRecord *nr = *it;
		NodeRef node = nr->node;

		if (mustBeNeighbor && !node->isNeighbor())
			continue;

		if (memcmp(id.c_str(), node->getIdStr(), MAX_NODE_ID_STR_LEN) == 0) 
			return node;
	}

	return NULL;
}
Example #2
0
NodeRef NodeStore::retrieve(const InterfaceRef &iface, bool mustBeNeighbor)
{
        Mutex::AutoLocker l(mutex);

        if (!iface)
	        return NULL;

	for (NodeStore::iterator it = begin(); it != end(); it++) {
		NodeRecord *nr = *it;
		NodeRef node = nr->node;

		if (mustBeNeighbor && !node->isNeighbor())
			continue;

		if (node->hasInterface(iface)) 
			return node;
	}

	return NULL;
}