avoid collapse when quit (msvc)

This commit is contained in:
DuckVador 2020-07-24 14:55:13 +08:00
parent 7e9f3ca9f2
commit 4174a18343

View File

@ -36,12 +36,14 @@ namespace Qv2ray::components::latency
if (!requests.empty())
requests.clear();
int timer_count = 0;
//LOG(MODULE_NETWORK,"fuck")
loop->walk([&timer_count,this](uvw::BaseHandle&h)
{
if(!h.closing())
timer_count++;
});
uv_walk(
loop->raw(),
[](uv_handle_t *handle, void *arg) {
int &counter = *static_cast<int *>(arg);
if (uv_is_closing(handle) == 0)
counter++;
},
&timer_count);
if (timer_count == 1) // only current timer
{
handle.stop();