Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Aug 10, 2023
1 parent 7519afb commit 9a66a26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/ylt/coro_io/client_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <ylt/util/expected.hpp>

#include "async_simple/coro/Collect.h"
#include "async_simple/coro/Mutex.h"
#include "coro_io.hpp"
#include "detail/client_queue.hpp"
#include "io_context_pool.hpp"
Expand Down Expand Up @@ -146,15 +147,17 @@ class client_pool : public std::enable_shared_from_this<
}

auto rand_time() {
//static thread_local std::default_random_engine r;
//std::uniform_int_distribution<int> e(-25, 25);
// static thread_local std::default_random_engine r;
// std::uniform_int_distribution<int> e(-25, 25);
return std::chrono::milliseconds{100};
}

async_simple::coro::Lazy<std::unique_ptr<client_t>> get_client(
const typename client_t::config& client_config) {
std::unique_ptr<client_t> client;

static async_simple::coro::Mutex m;
auto lock = co_await m.coScopedLock();
free_clients_.try_dequeue(client);
if (!client) {
short_connect_clients_.try_dequeue(client);
Expand Down

0 comments on commit 9a66a26

Please sign in to comment.