Compare commits
2 Commits
cc354b73e3
...
55448c2bfe
Author | SHA1 | Date | |
---|---|---|---|
55448c2bfe | |||
87725ad20a |
@ -95,8 +95,12 @@ class ServerResources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doTerminalUpgrade() {
|
void doTerminalUpgrade() const {
|
||||||
system(UPGRADE_COMMAND);
|
api->executeInApi([](TSID sid) {
|
||||||
|
CP_SetDmaDebug(sid, "begin_save_config", "");
|
||||||
|
system(UPGRADE_COMMAND);
|
||||||
|
CP_SetDmaDebug(sid, "save_config", "");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -100,8 +100,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
class api_driver::TerminalApiDaemon {
|
class api_driver::TerminalApiDaemon {
|
||||||
private:
|
private:
|
||||||
TSID sid;
|
|
||||||
boost::thread daemon;
|
|
||||||
|
|
||||||
void updateFirmwareSettings() {
|
void updateFirmwareSettings() {
|
||||||
std::string version, chip_id, sn, mac0, mac1;
|
std::string version, chip_id, sn, mac0, mac1;
|
||||||
@ -286,8 +284,6 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::mutex cpApiMutex;
|
|
||||||
|
|
||||||
std::shared_mutex firmwareMutex;
|
std::shared_mutex firmwareMutex;
|
||||||
TerminalFirmwareVersion firmware;
|
TerminalFirmwareVersion firmware;
|
||||||
|
|
||||||
@ -311,6 +307,10 @@ private:
|
|||||||
std::string qosClassesJson;
|
std::string qosClassesJson;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
std::mutex cpApiMutex;
|
||||||
|
TSID sid;
|
||||||
|
boost::thread daemon;
|
||||||
|
|
||||||
explicit TerminalApiDaemon(TSID sid): sid(sid), daemon([this]() { this->run(); }), qosEnabled(false) {
|
explicit TerminalApiDaemon(TSID sid): sid(sid), daemon([this]() { this->run(); }), qosEnabled(false) {
|
||||||
this->qosClassesJson = DEFAULT_QOS_CLASSES;
|
this->qosClassesJson = DEFAULT_QOS_CLASSES;
|
||||||
}
|
}
|
||||||
@ -892,6 +892,15 @@ void api_driver::ApiDriver::resetDefaultSettings() {
|
|||||||
daemon->resetDefaultSettings();
|
daemon->resetDefaultSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void api_driver::ApiDriver::executeInApi(const std::function<void(TSID sid)>& callback) {
|
||||||
|
try {
|
||||||
|
std::lock_guard lock(this->daemon->cpApiMutex);
|
||||||
|
callback(this->daemon->sid);
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "ApiDriver::executeInApi(): failed to exec with error: " << e.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool api_driver::ApiDriver::getIsCinC() const {
|
bool api_driver::ApiDriver::getIsCinC() const {
|
||||||
modulator_settings s{};
|
modulator_settings s{};
|
||||||
daemon->getSettings(&s, nullptr, nullptr, nullptr, nullptr);
|
daemon->getSettings(&s, nullptr, nullptr, nullptr, nullptr);
|
||||||
|
@ -67,6 +67,8 @@ namespace api_driver {
|
|||||||
|
|
||||||
void resetDefaultSettings();
|
void resetDefaultSettings();
|
||||||
|
|
||||||
|
void executeInApi(const std::function<void(TSID sid)>& callback);
|
||||||
|
|
||||||
~ApiDriver();
|
~ApiDriver();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1183,8 +1183,8 @@
|
|||||||
}
|
}
|
||||||
if (qc['filters'][fi].sport !== "") { filter['sport'] = qc['filters'][fi].sport }
|
if (qc['filters'][fi].sport !== "") { filter['sport'] = qc['filters'][fi].sport }
|
||||||
if (qc['filters'][fi].dport !== "") { filter['dport'] = qc['filters'][fi].dport }
|
if (qc['filters'][fi].dport !== "") { filter['dport'] = qc['filters'][fi].dport }
|
||||||
if (qc['filters'][fi].ip_src !== "") { filter['ip.src'] = qc['filters'][fi].ip_src }
|
if (qc['filters'][fi].ip_src !== "") { filter['ip_src'] = qc['filters'][fi].ip_src }
|
||||||
if (qc['filters'][fi].ip_dest !== "") { filter['ip.dest'] = qc['filters'][fi].ip_dest }
|
if (qc['filters'][fi].ip_dest !== "") { filter['ip_dest'] = qc['filters'][fi].ip_dest }
|
||||||
if (qc['filters'][fi].dscp !== "") { filter['dscp'] = qc['filters'][fi].dscp }
|
if (qc['filters'][fi].dscp !== "") { filter['dscp'] = qc['filters'][fi].dscp }
|
||||||
|
|
||||||
if (Object.keys(filter).length === 0) { continue }
|
if (Object.keys(filter).length === 0) { continue }
|
||||||
@ -1474,8 +1474,8 @@
|
|||||||
proto: qc['filters'][fi].hasOwnProperty('proto') ? qc['filters'][fi]['proto'].split(',') : [],
|
proto: qc['filters'][fi].hasOwnProperty('proto') ? qc['filters'][fi]['proto'].split(',') : [],
|
||||||
sport: qc['filters'][fi].hasOwnProperty('sport') ? qc['filters'][fi]['sport'] : '',
|
sport: qc['filters'][fi].hasOwnProperty('sport') ? qc['filters'][fi]['sport'] : '',
|
||||||
dport: qc['filters'][fi].hasOwnProperty('dport') ? qc['filters'][fi]['dport'] : '',
|
dport: qc['filters'][fi].hasOwnProperty('dport') ? qc['filters'][fi]['dport'] : '',
|
||||||
ip_src: qc['filters'][fi].hasOwnProperty('ip.src') ? qc['filters'][fi]['ip.src'] : '',
|
ip_src: qc['filters'][fi].hasOwnProperty('ip_src') ? qc['filters'][fi]['ip_src'] : '',
|
||||||
ip_dest: qc['filters'][fi].hasOwnProperty('ip.dest') ? qc['filters'][fi]['ip.dest'] : '',
|
ip_dest: qc['filters'][fi].hasOwnProperty('ip_dest') ? qc['filters'][fi]['ip_dest'] : '',
|
||||||
dscp: qc['filters'][fi].hasOwnProperty('dscp') ? qc['filters'][fi]['dscp'] : ''
|
dscp: qc['filters'][fi].hasOwnProperty('dscp') ? qc['filters'][fi]['dscp'] : ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user