mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-05 11:45:51 +00:00
Fix SNTPClock shutdown
This PR addresses a problem where the server could hang indefinitely on shutdown. The cause of the problem is the SNTPClock class was not binding the socket to an endpoint on initialization. This can create an error sent to the read handler. Unfortunately, the handler ignores the error, reads again and enters into a loop preventing the io_service from ever completing.
This commit is contained in:
committed by
Manoj doshi
parent
e83d367f49
commit
de99e79bf1
@@ -157,6 +157,7 @@ public:
|
|||||||
|
|
||||||
using namespace boost::asio;
|
using namespace boost::asio;
|
||||||
socket_.open (ip::udp::v4 ());
|
socket_.open (ip::udp::v4 ());
|
||||||
|
socket_.bind (ep_);
|
||||||
socket_.async_receive_from (buffer (buf_, 256),
|
socket_.async_receive_from (buffer (buf_, 256),
|
||||||
ep_, std::bind(
|
ep_, std::bind(
|
||||||
&SNTPClientImp::onRead, this,
|
&SNTPClientImp::onRead, this,
|
||||||
@@ -167,9 +168,6 @@ public:
|
|||||||
&SNTPClientImp::onTimer, this,
|
&SNTPClientImp::onTimer, this,
|
||||||
std::placeholders::_1));
|
std::placeholders::_1));
|
||||||
|
|
||||||
// VFALCO Is it correct to launch the thread
|
|
||||||
// here after queuing I/O?
|
|
||||||
//
|
|
||||||
thread_ = std::thread(&SNTPClientImp::doRun, this);
|
thread_ = std::thread(&SNTPClientImp::doRun, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user