diff --git a/src/addons/activeproxy/activeproxy.cc b/src/addons/activeproxy/activeproxy.cc index 3dfa4ae..89b8bb1 100644 --- a/src/addons/activeproxy/activeproxy.cc +++ b/src/addons/activeproxy/activeproxy.cc @@ -157,9 +157,9 @@ void ActiveProxy::onStop() noexcept log->info("Addon ActiveProxy is on-stopping..."); running = false; - uv_prepare_stop(&prepareHandle); + uv_check_stop(&checkHandle); uv_timer_stop(&timerHandle); - uv_close((uv_handle_t*)&prepareHandle, nullptr); + uv_close((uv_handle_t*)&checkHandle, nullptr); uv_close((uv_handle_t*)&timerHandle, nullptr); uv_close((uv_handle_t*)&stopHandle, nullptr); @@ -282,15 +282,15 @@ void ActiveProxy::start() stopHandle.data = this; // init the idle/iteration handle - uv_prepare_init(&loop, &prepareHandle); // always success - prepareHandle.data = this; - rc = uv_prepare_start(&prepareHandle, [](uv_prepare_t* handle) { + uv_check_init(&loop, &checkHandle); // always success + checkHandle.data = this; + rc = uv_check_start(&checkHandle, [](uv_check_t* handle) { ActiveProxy* ap = (ActiveProxy*)handle->data; ap->onIteration(); }); if (rc < 0) { log->error("Addon ActiveProxy failed to start the iteration handle({}): {}", rc, uv_strerror(rc)); - uv_close((uv_handle_t*)&prepareHandle, nullptr); + uv_close((uv_handle_t*)&checkHandle, nullptr); uv_close((uv_handle_t*)&stopHandle, nullptr); uv_loop_close(&loop); throw networking_error(uv_strerror(rc)); @@ -308,8 +308,8 @@ void ActiveProxy::start() }, HEALTH_CHECK_INTERVAL, HEALTH_CHECK_INTERVAL); if (rc < 0) { log->error("Addon ActiveProxy failed to start timer ({}): {}", rc, uv_strerror(rc)); - uv_prepare_stop(&prepareHandle); - uv_close((uv_handle_t*)&prepareHandle, nullptr); + uv_check_stop(&checkHandle); + uv_close((uv_handle_t*)&checkHandle, nullptr); uv_close((uv_handle_t*)&stopHandle, nullptr); uv_loop_close(&loop); throw networking_error(uv_strerror(rc)); @@ -324,9 +324,9 @@ void ActiveProxy::start() if (rc < 0) { log->error("Addon ActiveProxy failed to start the event loop({}): {}", rc, uv_strerror(rc)); running = false; - uv_prepare_stop(&prepareHandle); + uv_check_stop(&checkHandle); uv_timer_stop(&timerHandle); - uv_close((uv_handle_t*)&prepareHandle, nullptr); + uv_close((uv_handle_t*)&checkHandle, nullptr); uv_close((uv_handle_t*)&timerHandle, nullptr); uv_close((uv_handle_t*)&stopHandle, nullptr); uv_loop_close(&loop); diff --git a/src/addons/activeproxy/activeproxy.h b/src/addons/activeproxy/activeproxy.h index d75291e..2dd9552 100644 --- a/src/addons/activeproxy/activeproxy.h +++ b/src/addons/activeproxy/activeproxy.h @@ -204,7 +204,7 @@ class ActiveProxy : public Addon { uv_loop_t loop { 0 }; uv_async_t stopHandle { 0 }; - uv_prepare_t prepareHandle { 0 }; + uv_check_t checkHandle { 0 }; uv_timer_t timerHandle { 0 }; uint64_t lastConnectTimestamp { 0 };