diff --git a/xplat/Sonar/SonarWebSocketImpl.cpp b/xplat/Sonar/SonarWebSocketImpl.cpp index eea0aeb90..343aa7956 100644 --- a/xplat/Sonar/SonarWebSocketImpl.cpp +++ b/xplat/Sonar/SonarWebSocketImpl.cpp @@ -8,7 +8,6 @@ #include "SonarWebSocketImpl.h" #include -#include #include #include #include @@ -93,14 +92,15 @@ class Responder : public rsocket::RSocketResponder { SonarWebSocketImpl::SonarWebSocketImpl(SonarInitConfig config) : deviceData_(config.deviceData), worker_(config.worker) {} -folly::IOExecutor* ioExecutor; - SonarWebSocketImpl::~SonarWebSocketImpl() { stop(); } void SonarWebSocketImpl::start() { - folly::makeFuture().via(ioExecutor).then([this]() { startSync(); }); + folly::makeFuture() + .via(worker_->getEventBase()) + .delayedUnsafe(std::chrono::milliseconds(0)) + .then([this]() { startSync(); }); } void SonarWebSocketImpl::startSync() { @@ -184,8 +184,8 @@ void SonarWebSocketImpl::connectSecurely() { void SonarWebSocketImpl::reconnect() { folly::makeFuture() - .via(ioExecutor) - .delayed(std::chrono::seconds(reconnectIntervalSeconds)) + .via(worker_->getEventBase()) + .delayedUnsafe(std::chrono::seconds(reconnectIntervalSeconds)) .then([this]() { startSync(); }); }