PtrLList<String> * TopologyWorldState::getTargetNodes (DisServiceDataMsg *pDSDMsg)
{
    // Returns a list with the target nodes for pDSDMsg
    _m.lock (145);
    PtrLList<String> *pInterestedNodes = getInterestedRemoteNodes (pDSDMsg);
    PtrLList<String> *pTargetNodes = NULL;
    if (pInterestedNodes) {
        for (String *pSubNode = pInterestedNodes->getFirst(); pSubNode; pSubNode = pInterestedNodes->getNext()) {
            bool bActiveTarget = isActiveNeighbor (pSubNode->c_str());
            const char *pszBestGW = NULL;
            if (bActiveTarget) {
                pszBestGW = pSubNode->c_str();
            } else {
                pszBestGW = getBestGateway (pSubNode->c_str());
            }
            if (pszBestGW) {
                if (pTargetNodes == NULL) {
                    pTargetNodes = new PtrLList<String>();
                }
                if (pTargetNodes->search (new String (pszBestGW)) == NULL) {
                    pTargetNodes->insert (new String (pszBestGW));
                }
            }
        }
    }
    _m.unlock (145);
    return pTargetNodes;
}