改进协程循环逻辑2

This commit is contained in:
2026-06-25 15:17:55 +08:00
parent 1504db9db0
commit 6a87cf52a8
7 changed files with 86 additions and 88 deletions
+3 -8
View File
@@ -14,10 +14,6 @@ bool Data_Feed::registered() {
}
return false;
}
void Data_Feed_UDP_Server::handle_in_loop() {
(handle_in_loop_coro()).get();
}
concurrencpp::result<void> Data_Feed_UDP_Server::handle_in_loop_coro() {
co_await svr.tick_coro();
co_return;
@@ -27,12 +23,11 @@ concurrencpp::result<void> Data_Feed_UDP_Server::send_coro(const std::string& da
co_await svr.write_to_all_clients_coro(data);
co_return;
}
bool Data_Feed_UDP_Server::_open() {
concurrencpp::result<void> Data_Feed_UDP_Server::_open() {
svr.set_bind_address("0.0.0.0", port);
svr.create();
server_logger->c_debug({}, {}, to_string() + "开启!");
return true;
co_return;
}
JSON Data_feed_Config::get_feed(const std::string& key) {
auto ret = map.get(key);
@@ -251,4 +246,4 @@ concurrencpp::result<void> Data_Feed::loop_coro(
co_await concurrencpp::resume_on(executor_);
}
co_return;
}
}