Fixing framework.

This commit is contained in:
stephb9959
2022-04-03 18:42:55 -07:00
parent fe09ddfb5a
commit a3885b8b1c
4 changed files with 21 additions and 18 deletions

2
build
View File

@@ -1 +1 @@
35
36

View File

@@ -418,7 +418,7 @@ namespace OpenWifi {
},
"allow-dfs": {
"type": "boolean",
"default": false
"default": true
},
"channel-mode": {
"type": "string",
@@ -2444,6 +2444,7 @@ namespace OpenWifi {
}
}
}
)"_json;
class custom_error_handler : public nlohmann::json_schema::basic_error_handler

View File

@@ -18,6 +18,7 @@ namespace OpenWifi::KafkaTopics {
static const std::string SERVICE_EVENTS{"service_events"};
static const std::string DEVICE_EVENT_QUEUE{"device_event_queue"};
static const std::string DEVICE_TELEMETRY{"device_telemetry"};
static const std::string PROVISIONING_CHANGE{"provisioning_change"};
namespace ServiceEvents {
static const std::string EVENT_JOIN{"join"};

View File

@@ -3056,7 +3056,7 @@ namespace OpenWifi {
};
class SubSystemServer;
typedef std::map<uint64_t, MicroServiceMeta> MicroServiceMetaMap;
typedef std::map<std::string, MicroServiceMeta> MicroServiceMetaMap;
typedef std::vector<MicroServiceMeta> MicroServiceMetaVec;
typedef std::vector<SubSystemServer *> SubSystemVec;
@@ -3239,14 +3239,15 @@ namespace OpenWifi {
Object->has(KafkaTopics::ServiceEvents::Fields::PRIVATE) &&
Object->has(KafkaTopics::ServiceEvents::Fields::VRSN) &&
Object->has(KafkaTopics::ServiceEvents::Fields::KEY)) {
if (Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE && Services_.find(ID) != Services_.end()) {
Services_[ID].LastUpdate = std::time(nullptr);
auto PrivateEndPoint = Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString();
if (Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE && Services_.find(PrivateEndPoint) != Services_.end()) {
Services_[PrivateEndPoint].LastUpdate = std::time(nullptr);
} else if (Event == KafkaTopics::ServiceEvents::EVENT_LEAVE) {
Services_.erase(ID);
Services_.erase(PrivateEndPoint);
logger().information(fmt::format("Service {} ID={} leaving system.",Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString(),ID));
} else if (Event == KafkaTopics::ServiceEvents::EVENT_JOIN || Event == KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE) {
logger().information(fmt::format("Service {} ID={} joining system.",Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString(),ID));
Services_[ID] = MicroServiceMeta{
Services_[PrivateEndPoint] = MicroServiceMeta{
.Id = ID,
.Type = Poco::toLower(Object->get(KafkaTopics::ServiceEvents::Fields::TYPE).toString()),
.PrivateEndPoint = Object->get(KafkaTopics::ServiceEvents::Fields::PRIVATE).toString(),
@@ -3254,8 +3255,8 @@ namespace OpenWifi {
.AccessKey = Object->get(KafkaTopics::ServiceEvents::Fields::KEY).toString(),
.Version = Object->get(KafkaTopics::ServiceEvents::Fields::VRSN).toString(),
.LastUpdate = (uint64_t)std::time(nullptr)};
for (const auto &[Id, Svc] : Services_) {
logger().information(fmt::format("ID: {} Type: {} EndPoint: {}",Id,Svc.Type,Svc.PrivateEndPoint));
for (const auto &[PrivateEndPoint, Svc] : Services_) {
logger().information(fmt::format("ID: {} Type: {} EndPoint: {}",Svc.Id,Svc.Type,PrivateEndPoint));
}
}
} else {
@@ -3307,7 +3308,7 @@ namespace OpenWifi {
std::lock_guard G(InfraMutex_);
MicroServiceMetaVec Res;
for(const auto &[Id,ServiceRec]:Services_) {
for(const auto &[_,ServiceRec]:Services_) {
Res.push_back(ServiceRec);
}
return Res;