Example #1
0
 bool CheckIfMaster() {
   vector<Master>::iterator iter = m_masters.begin();
   uint8_t priority = 0;
   Master *preferred_master = NULL;
   for (; iter != m_masters.end(); ++iter) {
     if (iter->priority > priority &&
         iter->address.Host() != IPV4Address::WildCard()) {
       preferred_master = &(*iter);
       priority = iter->priority;
     }
   }
   return (preferred_master &&
           preferred_master->address.Port() == m_listen_address.Port() &&
           STLContains(m_local_ips, preferred_master->address.Host()));
 }