This commit is contained in:
andrey.bychkov
2024-09-17 12:31:03 +03:00
parent bc6b584480
commit b99c51181d

View File

@@ -154,6 +154,7 @@ TEST(ClientServer, DynamicClients) {
auto s = createServer<true, true, 10_KiB>();
const auto spawnClient = [&clients, &clients_mutex]() {
if (clients.size() > 100) return;
auto c = new ClientSendThread();
c->startSend();
clients_mutex.lock();
@@ -173,16 +174,17 @@ TEST(ClientServer, DynamicClients) {
spawnThread.start(
[&spawnClient]() {
const int new_cnt = randomi() % 10;
const int new_cnt = 7;
piForTimes(new_cnt) {
spawnClient();
}
piCout << "+++++++";
},
12_Hz);
52_Hz);
deleteThread.start(
[&clients, &clients_mutex]() {
const int rm_cnt = randomi() % 10;
const int rm_cnt = 8;
piForTimes(rm_cnt) {
ClientSendThread * c = nullptr;
clients_mutex.lock();
@@ -195,8 +197,9 @@ TEST(ClientServer, DynamicClients) {
piCout << "remove client" << clients.size();
}
}
piCout << "----------";
},
13_Hz);
53_Hz);
(10_s).sleep();