Revision b38874a0 src/raft/RaftManager.cc

View differences:

src/raft/RaftManager.cc
101 101

  
102 102
    // -------------------------------------------------------------------------
103 103
    // Initialize Raft timers
104
    //   TODO: randomize election timeout
105 104
    // -------------------------------------------------------------------------
106 105
    purge_period_ms   = log_purge * 1000;
107 106
    xmlrpc_timeout_ms = xmlrpc;
......
173 172

  
174 173
static unsigned int get_zone_servers(std::map<unsigned int, std::string>& _serv)
175 174
{
176
    unsigned int  _num_servers;
177

  
178 175
    Nebula& nd       = Nebula::instance();
179 176
    ZonePool * zpool = nd.get_zonepool();
180 177

  
181 178
    int zone_id = nd.get_zone_id();
182 179

  
183
    ZoneServers::zone_iterator zit;
184

  
185
    Zone * zone = zpool->get(zone_id, true);
186

  
187
    if ( zone == 0 )
188
    {
189
        _serv.clear();
190
        return 0;
191
    }
192

  
193
    ZoneServers * followers = zone->get_servers();
194

  
195
    for (zit = followers->begin(); zit != followers->end(); ++zit)
196
    {
197
        unsigned int id  = (*zit)->get_id();
198
        std::string  edp = (*zit)->vector_value("ENDPOINT");
199

  
200
        _serv.insert(make_pair(id, edp));
201
    }
202

  
203
    _num_servers = zone->servers_size();
204

  
205
    zone->unlock();
206

  
207
    return _num_servers;
180
    return zpool->get_zone_servers(zone_id, _serv);
208 181
}
209 182

  
210 183
int RaftManager::get_leader_endpoint(std::string& endpoint)

Also available in: Unified diff