tcp udp 改协程

This commit is contained in:
2026-06-23 09:23:01 +08:00
parent 9a140f7379
commit 816c7c3c1d
5 changed files with 22 additions and 14 deletions
@@ -224,7 +224,7 @@ protected:
struct TCP_Client_Data_Source : Data_Source {
void handle_in_loop() override {
cli.tick();
ucoro::sync_await(cli.tick_coro());
}
Psc::JSON get_custom_state_json() override {
auto& state = cli.state;
@@ -245,6 +245,7 @@ struct TCP_Client_Data_Source : Data_Source {
cli.set_dest_address(addr);
cli.create();
ucoro::sync_await(cli.connect_coro());
return true;
}
void _close() override { cli.close(); }
@@ -262,7 +263,7 @@ struct TCP_Client_Data_Source : Data_Source {
}
std::string read() override {
return cli.read();
return ucoro::sync_await(cli.read_coro());
}
};
struct Serial_Data_Source : Data_Source {