fix GW init procedure and set pool instance in ctor

master
Andre Puschmann 5 years ago
parent 2e1479e9d6
commit 1a7142d73f

@ -70,27 +70,27 @@ public:
private: private:
static const int GW_THREAD_PRIO = 7; static const int GW_THREAD_PRIO = 7;
stack_interface_gw* stack; stack_interface_gw* stack = nullptr;
srslte::byte_buffer_pool* pool; srslte::byte_buffer_pool* pool = nullptr;
srslte::logger* logger; srslte::logger* logger = nullptr;
gw_args_t args; gw_args_t args = {};
bool running; bool running = false;
bool run_enable; bool run_enable = false;
int32_t tun_fd; int32_t tun_fd = 0;
struct ifreq ifr; struct ifreq ifr = {};
int32_t sock; int32_t sock = 0;
bool if_up; bool if_up = false;
uint32_t default_lcid = 0; uint32_t default_lcid = 0;
srslte::log_filter log; srslte::log_filter log;
uint32_t current_ip_addr; uint32_t current_ip_addr = 0;
uint8_t current_if_id[8]; uint8_t current_if_id[8];
long ul_tput_bytes; long ul_tput_bytes = 0;
long dl_tput_bytes; long dl_tput_bytes = 0;
struct timeval metrics_time[3]; struct timeval metrics_time[3];
void run_thread(); void run_thread();
@ -101,9 +101,9 @@ private:
void del_ipv6_addr(struct in6_addr* in6p); void del_ipv6_addr(struct in6_addr* in6p);
// MBSFN // MBSFN
int mbsfn_sock_fd; // Sink UDP socket file descriptor int mbsfn_sock_fd = 0; // Sink UDP socket file descriptor
struct sockaddr_in mbsfn_sock_addr; // Target address struct sockaddr_in mbsfn_sock_addr = {}; // Target address
uint32_t mbsfn_ports[SRSLTE_N_MCH_LCIDS]; // Target ports for MBSFN data uint32_t mbsfn_ports[SRSLTE_N_MCH_LCIDS] = {}; // Target ports for MBSFN data
// TFT // TFT
std::mutex tft_mutex; std::mutex tft_mutex;
@ -115,5 +115,4 @@ private:
} // namespace srsue } // namespace srsue
#endif // SRSUE_GW_H #endif // SRSUE_GW_H

@ -34,14 +34,10 @@
namespace srsue { namespace srsue {
gw::gw() : if_up(false), default_lcid(0), thread("GW") gw::gw() : thread("GW"), pool(srslte::byte_buffer_pool::get_instance()) {}
{
current_ip_addr = 0;
}
int gw::init(const gw_args_t& args_, srslte::logger* logger_, stack_interface_gw* stack_) int gw::init(const gw_args_t& args_, srslte::logger* logger_, stack_interface_gw* stack_)
{ {
pool = srslte::byte_buffer_pool::get_instance();
stack = stack_; stack = stack_;
logger = logger_; logger = logger_;
args = args_; args = args_;
@ -52,8 +48,6 @@ int gw::init(const gw_args_t& args_, srslte::logger* logger_, stack_interface_gw
log.set_hex_limit(args.log.gw_hex_limit); log.set_hex_limit(args.log.gw_hex_limit);
gettimeofday(&metrics_time[1], NULL); gettimeofday(&metrics_time[1], NULL);
dl_tput_bytes = 0;
ul_tput_bytes = 0;
// MBSFN // MBSFN
mbsfn_sock_fd = socket(AF_INET, SOCK_DGRAM, 0); mbsfn_sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
@ -69,8 +63,6 @@ int gw::init(const gw_args_t& args_, srslte::logger* logger_, stack_interface_gw
mbsfn_sock_addr.sin_family = AF_INET; mbsfn_sock_addr.sin_family = AF_INET;
mbsfn_sock_addr.sin_addr.s_addr =inet_addr("127.0.0.1"); mbsfn_sock_addr.sin_addr.s_addr =inet_addr("127.0.0.1");
bzero(mbsfn_ports, SRSLTE_N_MCH_LCIDS*sizeof(uint32_t));
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }

Loading…
Cancel
Save