Revision c98457ae

View differences:

src/raft/RaftManager.cc
605 605
        }
606 606
    }
607 607

  
608
    if ( db_last_index > replicated_index )
608
    if ((db_last_index > replicated_index) && (state == LEADER))
609 609
    {
610 610
        replica_manager.replicate(follower_id);
611 611
    }
......
632 632
        }
633 633
    }
634 634

  
635
    replica_manager.replicate(follower_id);
635
    if ( state == LEADER )
636
    {
637
        replica_manager.replicate(follower_id);
638
    }
636 639

  
637 640
    pthread_mutex_unlock(&mutex);
638 641
}
src/raft/ReplicaManager.cc
59 59
    for ( it = thread_pool.begin() ; it != thread_pool.end() ; ++it )
60 60
    {
61 61
        it->second->finalize();
62

  
63
        pthread_cancel(it->second->thread_id());
64

  
65
        delete it->second;
66 62
    }
67 63

  
68 64
    thread_pool.clear();
......
110 106

  
111 107
    it->second->finalize();
112 108

  
113
    NebulaLog::log("RCM", Log::INFO, "Replication thread stopped");
114

  
115
    delete it->second;
116

  
117 109
    thread_pool.erase(it);
118 110
};
119 111

  
src/raft/ReplicaThread.cc
55 55

  
56 56
    rt->do_replication();
57 57

  
58
    NebulaLog::log("RCM", Log::INFO, "Replication thread stopped");
59

  
60
    delete rt;
61

  
58 62
    return 0;
59 63
}
60 64

  

Also available in: Unified diff