<commit_before>#include "slave.hpp"
#include <stdint.h>
#include "net_structs.hpp"
#include "arch/linux/coroutines.hpp"

namespace replication {


// TODO unit test offsets

slave_t::slave_t(store_t *internal_store, replication_config_t replication_config, failover_config_t failover_config) 
    : internal_store(internal_store), 
      replication_config(replication_config), 
      failover_config(failover_config),
      conn(NULL),
      shutting_down(false),
      failover_script(failover_config.failover_script_path),
      timeout(INITIAL_TIMEOUT),
      timer_token(NULL),
      failover_reset_control(std::string("failover reset"), this),
      new_master_control(std::string("new master"), this)
{
    coro_t::spawn(&run, this);
}

slave_t::~slave_t() {
    shutting_down = true;
    coro_t::move_to_thread(home_thread);
    kill_conn();
    
    /* cancel the timer */
    if(timer_token) cancel_timer(timer_token);
}
<commit_msg>Fixed compilation error with slave.cc when MOCK_CACHE_CHECK=1 DEBUG=1.<commit_after>#include "slave.hpp"

#include <stdint.h>

#include "arch/linux/coroutines.hpp"
#include "logger.hpp"
#include "net_structs.hpp"

namespace replication {


// TODO unit test offsets

slave_t::slave_t(store_t *internal_store, replication_config_t replication_config, failover_config_t failover_config) 
    : internal_store(internal_store), 
      replication_config(replication_config), 
      failover_config(failover_config),
      conn(NULL),
      shutting_down(false),
      failover_script(failover_config.failover_script_path),
      timeout(INITIAL_TIMEOUT),
      timer_token(NULL),
      failover_reset_control(std::string("failover reset"), this),
      new_master_control(std::string("new master"), this)
{
    coro_t::spawn(&run, this);
}

slave_t::~slave_t() {
    shutting_down = true;
    coro_t::move_to_thread(home_thread);
    kill_conn();
    
    /* cancel the timer */
    if(timer_token) cancel_timer(timer_token);
}

{'fraction_non_alphanumeric': 0.11692933401118455, 'fraction_numerical': 0.0010167768174885613, 'mean_word_length': 4.8053097345132745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2850333', 'n_tokens_mistral': 665, 'n_tokens_neox': 652, 'n_words': 101}