Changeset 14552 for trunk


Ignore:
Timestamp:
11/03/12 18:53:59 (12 years ago)
Author:
tbretz
Message:
Make sure that one server is never subscribed twice.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DimState.h

    r14541 r14552  
    1111#include "Description.h"
    1212#include "StateMachineImp.h"
    13 
     13#include<iostream>
    1414class DimState
    1515{
     
    409409    std::vector<std::string> fServiceList;
    410410
     411    std::set<std::string> fServers;
     412
    411413    void CallbackServerAdd(const std::string &server)
    412414    {
     415        DimDnsServerList::CallbackServerAdd(server);
     416
     417        if (fServers.find(server)!=fServers.end())
     418            return;
     419
    413420        fStateMachine->Subscribe(server+"/SERVICE_LIST")
    414421            (fStateMachine->Wrap(std::bind(&DimDnsServiceList::HandlerServiceList, this, std::placeholders::_1)));
    415422
    416         DimDnsServerList::CallbackServerAdd(server);
     423        fServers.insert(server);
    417424    }
    418425
Note: See TracChangeset for help on using the changeset viewer.