LivoxProto1:connectReq: Remove retryDelay; DevReattacher replaces
The new DeviceReattacher daemon in DeviceManager makes this retry delay feature obsolete.
This commit is contained in:
@@ -125,7 +125,6 @@ class Device::ConnectReq
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Device& device;
|
Device& device;
|
||||||
std::unique_ptr<boost::asio::deadline_timer> retryTimer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectReq(Device& dev, smo::Callback<Device::connectReqCbFn> cb)
|
ConnectReq(Device& dev, smo::Callback<Device::connectReqCbFn> cb)
|
||||||
@@ -179,63 +178,6 @@ public:
|
|||||||
context->device.heartbeatFd = fd;
|
context->device.heartbeatFd = fd;
|
||||||
context->device.startHeartbeat();
|
context->device.startHeartbeat();
|
||||||
context->callOriginalCb(true);
|
context->callOriginalCb(true);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start retry timer
|
|
||||||
if (OptionParser::getOptions().verbose)
|
|
||||||
{
|
|
||||||
std::cout << __func__ << ": Starting retry delay ("
|
|
||||||
<< context->device.retryDelayMs << "ms), then trying known "
|
|
||||||
<< "device again" << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
context->retryTimer = std::make_unique<boost::asio::deadline_timer>(
|
|
||||||
context->device.componentThread->getIoService());
|
|
||||||
|
|
||||||
context->retryTimer->expires_from_now(
|
|
||||||
boost::posix_time::milliseconds(context->device.retryDelayMs));
|
|
||||||
|
|
||||||
context->retryTimer->async_wait(
|
|
||||||
std::bind(
|
|
||||||
&ConnectReq::connectReq3, context.get(), context,
|
|
||||||
std::placeholders::_1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void connectReq3(
|
|
||||||
std::shared_ptr<ConnectReq> context,
|
|
||||||
const boost::system::error_code& error
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
{
|
|
||||||
context->callOriginalCb(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OptionParser::getOptions().verbose)
|
|
||||||
{
|
|
||||||
std::cout << __func__ << ": Trying to connect to known device "
|
|
||||||
<< "again" << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
context->device.connectToKnownDeviceReq(
|
|
||||||
{context, std::bind(&ConnectReq::connectReq4, context.get(), context,
|
|
||||||
std::placeholders::_1, std::placeholders::_2,
|
|
||||||
std::placeholders::_3)});
|
|
||||||
}
|
|
||||||
|
|
||||||
void connectReq4(
|
|
||||||
std::shared_ptr<ConnectReq> context,
|
|
||||||
bool success, const std::string& ipAddr, int fd
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
context->device.discoveredDevice.ipAddr = ipAddr;
|
|
||||||
context->device.heartbeatFd = fd;
|
|
||||||
context->device.startHeartbeat();
|
|
||||||
context->callOriginalCb(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user