修完bug
This commit is contained in:
@@ -108,8 +108,7 @@ size_t Data_Source_Handler::process_mode_acs_data(std::string_view origin_data)
|
||||
}
|
||||
auto source = ds(this);
|
||||
auto size = mode_data.size();
|
||||
read_speed.update(size);
|
||||
value_statistics.update(size);
|
||||
input_statistics.update(size);
|
||||
// 预处理数据
|
||||
static bool mode_s_console = Global::instance()->console_config.mode_s_console;
|
||||
static bool record_playback = Global::instance()->console_config.record_playback;
|
||||
@@ -410,9 +409,14 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
const auto [other_size, s_size] = Global::instance()->mode_acs.settings.read([](const auto& value) {
|
||||
return std::pair{value.mode_other_max_num, value.mode_s_max_num};
|
||||
});
|
||||
std::vector<std::string> list;
|
||||
for (const auto& item : cached_data_feed_key_list) {
|
||||
auto& key = item.key;
|
||||
std::vector<std::string> feed_keys;
|
||||
{
|
||||
std::lock_guard lock(cdf_mtx);
|
||||
feed_keys.reserve(cached_data_feed_key_list.size());
|
||||
for (const auto& item : cached_data_feed_key_list)
|
||||
feed_keys.push_back(item.key);
|
||||
}
|
||||
for (const auto& key : feed_keys) {
|
||||
auto opt_feed = Global::instance()->mode_acs.data_feed_config.map.get(key);
|
||||
if (!opt_feed.has_value()) {
|
||||
std::cout << "wrong data feed: " << key << std::endl;
|
||||
@@ -421,7 +425,13 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
std::shared_ptr<Data_Feed>& feed = opt_feed.value();
|
||||
if (!feed->enabled())
|
||||
continue;
|
||||
if (msg->type == SSR::Mode_Msg::T::S7 || msg->type == SSR::Mode_Msg::T::S14) {
|
||||
const bool mode_s = msg->type == SSR::Mode_Msg::T::S7 || msg->type == SSR::Mode_Msg::T::S14;
|
||||
std::optional<std::string> binary = convert_to_send_format(this, feed, msg);
|
||||
if (!binary.has_value()) {
|
||||
feed->record_filtered(msg->packet.size());
|
||||
continue;
|
||||
}
|
||||
if (mode_s) {
|
||||
// static Frequency_Limit fl;
|
||||
// if (!fl.test()) {
|
||||
// std::ostringstream oss;
|
||||
@@ -429,7 +439,8 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
// ,feed->msg_buffer.mode_s_msg_num, s_size) << std::endl; std::cout
|
||||
// << oss.str() << std::endl;
|
||||
// }
|
||||
if (feed->msg_buffer.mode_s_msg_num > s_size) {
|
||||
if (feed->msg_buffer.mode_s_msg_num >= s_size) {
|
||||
feed->record_dropped(binary->size(), true);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
@@ -437,27 +448,22 @@ void Data_Source_Handler::push_to_feed(const std::shared_ptr<SSR::Msg>& msg) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (feed->msg_buffer.mode_other_msg_num > other_size) {
|
||||
if (feed->msg_buffer.mode_other_msg_num >= other_size) {
|
||||
feed->record_dropped(binary->size(), false);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
++feed->msg_buffer.mode_other_msg_num;
|
||||
}
|
||||
}
|
||||
std::optional<std::string> binary = convert_to_send_format(this, feed, msg);
|
||||
if (binary.has_value()) {
|
||||
feed->msg_buffer.push(binary.value());
|
||||
}
|
||||
feed->msg_buffer.push(binary.value());
|
||||
feed->record_queued(binary->size());
|
||||
}
|
||||
}
|
||||
Psc::JSON Data_Source_Handler::get_all_connect_feed_status() {
|
||||
Psc::JSON ret = Psc::JSON::object();
|
||||
std::vector<Cached_Source_Info> list;
|
||||
{
|
||||
std::lock_guard g(cdf_mtx);
|
||||
list = cached_data_feed_key_list;
|
||||
}
|
||||
for (auto& i : list) {
|
||||
std::lock_guard lock(cdf_mtx);
|
||||
for (auto& i : cached_data_feed_key_list) {
|
||||
Psc::JSON cur = Psc::JSON::object();
|
||||
auto odf = Global::instance()->mode_acs.data_feed_config.map.get(i.key);
|
||||
if (odf.has_value()) {
|
||||
|
||||
Reference in New Issue
Block a user