mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 11:35:53 +00:00
Allow SNTP in standalone mode. It was partially disabled before.
This commit is contained in:
@@ -47,16 +47,13 @@ static uint8_t SNTPQueryData[48] =
|
|||||||
SNTPClient::SNTPClient(boost::asio::io_service& service) : mSocket(service), mTimer(service), mResolver(service),
|
SNTPClient::SNTPClient(boost::asio::io_service& service) : mSocket(service), mTimer(service), mResolver(service),
|
||||||
mOffset(0), mLastOffsetUpdate((time_t) -1), mReceiveBuffer(256)
|
mOffset(0), mLastOffsetUpdate((time_t) -1), mReceiveBuffer(256)
|
||||||
{
|
{
|
||||||
if (!theConfig.RUN_STANDALONE)
|
mSocket.open(boost::asio::ip::udp::v4());
|
||||||
{
|
mSocket.async_receive_from(boost::asio::buffer(mReceiveBuffer, 256), mReceiveEndpoint,
|
||||||
mSocket.open(boost::asio::ip::udp::v4());
|
boost::bind(&SNTPClient::receivePacket, this, boost::asio::placeholders::error,
|
||||||
mSocket.async_receive_from(boost::asio::buffer(mReceiveBuffer, 256), mReceiveEndpoint,
|
boost::asio::placeholders::bytes_transferred));
|
||||||
boost::bind(&SNTPClient::receivePacket, this, boost::asio::placeholders::error,
|
|
||||||
boost::asio::placeholders::bytes_transferred));
|
|
||||||
|
|
||||||
mTimer.expires_from_now(boost::posix_time::seconds(NTP_QUERY_FREQUENCY));
|
mTimer.expires_from_now(boost::posix_time::seconds(NTP_QUERY_FREQUENCY));
|
||||||
mTimer.async_wait(boost::bind(&SNTPClient::timerEntry, this, boost::asio::placeholders::error));
|
mTimer.async_wait(boost::bind(&SNTPClient::timerEntry, this, boost::asio::placeholders::error));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SNTPClient::resolveComplete(const boost::system::error_code& error, boost::asio::ip::udp::resolver::iterator it)
|
void SNTPClient::resolveComplete(const boost::system::error_code& error, boost::asio::ip::udp::resolver::iterator it)
|
||||||
|
|||||||
Reference in New Issue
Block a user