Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
agent: Modify backhaul manager constructor
Browse files Browse the repository at this point in the history
While implementing agent_ucc_listener, the thought was to locate it on
the backhaul manager. Eventually, it was not implemented on the backhaul
manager, but some changes made during the implementation process,
on class constructor and initialization which are more efficient, and
makes the code cleaner, so I decided to push it.

Signed-off-by: Moran Shoeg <[email protected]>
  • Loading branch information
morantr committed Oct 31, 2019
1 parent 89e8665 commit 7021562
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,20 @@ const char *main_thread::s_arrStates[] = {FOREACH_STATE(GENERATE_STRING)};
/////////////////////////////// Implementation ///////////////////////////////
//////////////////////////////////////////////////////////////////////////////

main_thread::main_thread(std::string temp_path_, std::set<std::string> slave_ap_ifaces_,
std::set<std::string> slave_sta_ifaces_, int stop_on_failure_attempts_,
std::string const_bh_slave_)
: transport_socket_thread(temp_path_ + std::string(BEEROCKS_BACKHAUL_MGR_UDS)),
beerocks_temp_path(temp_path_), slave_ap_ifaces(slave_ap_ifaces_),
slave_sta_ifaces(slave_sta_ifaces_), pending_slave_ifaces(slave_ap_ifaces_),
config_const_bh_slave(const_bh_slave_), stop_on_failure_attempts(stop_on_failure_attempts_),
m_eFSMState(EState::INIT)
main_thread::main_thread(const config_file::sConfigSlave &config,
const std::set<std::string> &slave_ap_ifaces_,
const std::set<std::string> &slave_sta_ifaces_)
: transport_socket_thread(config.temp_path + std::string(BEEROCKS_BACKHAUL_MGR_UDS)),
beerocks_temp_path(config.temp_path), slave_ap_ifaces(slave_ap_ifaces_),
slave_sta_ifaces(slave_sta_ifaces_), config_const_bh_slave(config.const_backhaul_slave)
{
thread_name = "backhaul_manager";
LOG(DEBUG) << "stop_on_failure_attempts=" << stop_on_failure_attempts;
configuration_stop_on_failure_attempts = stop_on_failure_attempts;
thread_name = "backhaul_manager";
pending_slave_ifaces = slave_ap_ifaces_;
configuration_stop_on_failure_attempts = string_utils::stoi(config.stop_on_failure_attempts);
stop_on_failure_attempts = configuration_stop_on_failure_attempts;
LOG(DEBUG) << "stop_on_failure_attempts=" << configuration_stop_on_failure_attempts;

m_eFSMState = EState::INIT;
set_select_timeout(SELECT_TIMEOUT_MSC);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <beerocks/bwl/sta_wlan_hal.h>

#include <beerocks/bcl/beerocks_config_file.h>
#include <beerocks/bcl/beerocks_socket_thread.h>
#include <beerocks/bcl/network/network_utils.h>

Expand All @@ -29,9 +30,9 @@ namespace backhaul_manager {
class main_thread : public btl::transport_socket_thread {

public:
main_thread(std::string temp_path_, std::set<std::string> slave_ap_ifaces_,
std::set<std::string> slave_sta_ifaces_, int stop_on_failure_attempts,
std::string const_bh_slave_);
main_thread(const config_file::sConfigSlave &config,
const std::set<std::string> &slave_ap_ifaces_,
const std::set<std::string> &slave_sta_ifaces_);
~main_thread();

virtual bool init() override;
Expand Down Expand Up @@ -84,7 +85,7 @@ class main_thread : public btl::transport_socket_thread {
std::shared_ptr<bwl::sta_wlan_hal> get_wireless_hal(std::string iface = "");

private:
std::string beerocks_temp_path;
const std::string &beerocks_temp_path;

struct SSlaveSockets {
Socket *slave = nullptr;
Expand Down Expand Up @@ -137,8 +138,8 @@ class main_thread : public btl::transport_socket_thread {
int unassociated_rssi_measurement_header_id = -1;

//comes from config file
const std::set<std::string> slave_ap_ifaces;
const std::set<std::string> slave_sta_ifaces;
const std::set<std::string> &slave_ap_ifaces;
const std::set<std::string> &slave_sta_ifaces;

//used for several states independently
std::set<std::string> pending_slave_ifaces;
Expand All @@ -149,7 +150,8 @@ class main_thread : public btl::transport_socket_thread {
net::network_utils::iface_info bridge_info;

int configuration_stop_on_failure_attempts;
std::string config_const_bh_slave;
const std::string &config_const_bh_slave;

int stop_on_failure_attempts;
bool local_master = false;
bool local_gw = false;
Expand Down
5 changes: 2 additions & 3 deletions agent/src/beerocks/slave/beerocks_slave_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,8 @@ static int run_beerocks_slave(beerocks::config_file::sConfigSlave &beerocks_slav
son::slave_thread::sSlaveConfig son_slave_conf;
fill_son_slave_config(beerocks_slave_conf, son_slave_conf, 0);

beerocks::backhaul_manager::main_thread backhaul_mgr(
beerocks_slave_conf.temp_path, slave_ap_ifaces, slave_sta_ifaces,
(son_slave_conf.stop_on_failure_attempts), beerocks_slave_conf.const_backhaul_slave);
beerocks::backhaul_manager::main_thread backhaul_mgr(beerocks_slave_conf, slave_ap_ifaces,
slave_sta_ifaces);

beerocks::platform_manager::main_thread platform_mgr(beerocks_slave_conf, slave_logger);

Expand Down

0 comments on commit 7021562

Please sign in to comment.