FACT++  1.0
void DimDnsServerList::HandlerServerImp ( const EventImp evt)
protected

Definition at line 6 of file DimState.cc.

References EventImp::GetSize(), EventImp::GetString(), EventImp::GetTime(), and time.

7 {
8  if (evt.GetSize()==0)
9  return;
10 
11  time = evt.GetTime();
12  msg = evt.GetString();
13 
14  typedef char_separator<char> separator;
15  const tokenizer<separator> tok(msg, separator("|"));
16 
17  for (auto it=tok.begin(); it!=tok.end(); it++)
18  {
19  const size_t p = it->find_first_of('@');
20  if (p==string::npos)
21  continue;
22 
23  // The first part before the first @ is the server name
24  string server = it->substr(0, p);
25  if (server.empty())
26  continue;
27 
28  // If it starts with a - we have to remove an entry
29  if (server[0]=='-')
30  {
31  fServerList.erase(server.substr(1));
32  CallbackServerRemove(server.substr(1));
33  continue;
34  }
35 
36  // If it starts with a + we have to add an entry
37  if (server[0]=='+')
38  server = server.substr(1);
39 
40  // Check if this server is already in the list.
41  // This should never happen if Dim works reliable
42  if (fServerList.insert(server).second)
43  CallbackServerAdd(server);
44  }
45 }
virtual void CallbackServerRemove(const std::string &str)
Definition: DimState.h:333
std::string GetString() const
Definition: EventImp.cc:194
virtual void CallbackServerAdd(const std::string &str)
Definition: DimState.h:328
std::string msg
Definition: DimState.h:360
virtual Time GetTime() const
Definition: EventImp.h:57
std::set< std::string > fServerList
Definition: DimState.h:324
virtual size_t GetSize() const
Definition: EventImp.h:55

+ Here is the call graph for this function: