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

Commit

Permalink
agent: Add agent_ucc_listener to son_slave
Browse files Browse the repository at this point in the history
Add agent_ucc_listener to son_slave.
In this scope, add to son_slave lock and unlock calls to before and
after select, because it has a shared memory with the ucc_listener.

Signed-off-by: Moran Shoeg <[email protected]>
  • Loading branch information
morantr committed Oct 31, 2019
1 parent 461e141 commit 89e8665
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions agent/src/beerocks/slave/son_slave_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ bool slave_thread::init()
return false;
}

if (config.ucc_listener_slave_hostap_iface == config.hostap_iface &&
config.ucc_listener_port != 0) {
m_agent_ucc_listener =
std::make_unique<agent_ucc_listener>(config.ucc_listener_port, config.vendor,
config.model, config.bridge_iface, &master_socket);
if (m_agent_ucc_listener && !m_agent_ucc_listener->start("ucc_listener")) {
LOG(ERROR) << "failed start agent_ucc_listener";
return false;
}
}

return socket_thread::init();
}

Expand Down Expand Up @@ -334,6 +345,20 @@ bool slave_thread::work()
return true;
}

void slave_thread::before_select()
{
if (m_agent_ucc_listener) {
m_agent_ucc_listener->unlock();
}
}

void slave_thread::after_select(bool timeout)
{
if (m_agent_ucc_listener) {
m_agent_ucc_listener->lock();
}
}

void slave_thread::process_keep_alive()
{
if (!config.enable_keep_alive || !son_config.slave_keep_alive_retries) {
Expand Down
6 changes: 6 additions & 0 deletions agent/src/beerocks/slave/son_slave_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#ifndef _SON_SLAVE_THREAD_H
#define _SON_SLAVE_THREAD_H

#include "agent_ucc_listener.h"
#include "ap_manager_thread.h"

#include <beerocks/bcl/beerocks_backport.h>
Expand Down Expand Up @@ -148,6 +149,9 @@ class slave_thread : public beerocks::socket_thread {

void process_keep_alive();

void before_select() override;
void after_select(bool timeout) override;

bool slave_fsm(bool &call_slave_select);
void slave_reset();
void stop_slave_thread();
Expand Down Expand Up @@ -279,6 +283,8 @@ class slave_thread : public beerocks::socket_thread {
uint8_t *m1_auth_buf = nullptr;
size_t m1_auth_buf_len = 0;

std::unique_ptr<beerocks::agent_ucc_listener> m_agent_ucc_listener;

bool parse_intel_join_response(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx);
bool parse_non_intel_join_response(Socket *sd);
bool handle_autoconfiguration_wsc(Socket *sd, ieee1905_1::CmduMessageRx &cmdu_rx);
Expand Down

0 comments on commit 89e8665

Please sign in to comment.