#510 - move m_Acceptor.reset under try

This commit is contained in:
R4SAS 2019-05-17 13:35:42 +03:00
parent 754299339d
commit d49dde7c5e

View file

@ -282,10 +282,10 @@ namespace client
void TCPIPAcceptor::Start () void TCPIPAcceptor::Start ()
{ {
m_Acceptor.reset (new boost::asio::ip::tcp::acceptor (GetService (), m_LocalEndpoint));
// update the local end point in case port has been set zero and got updated now
m_LocalEndpoint = m_Acceptor->local_endpoint();
try { try {
m_Acceptor.reset (new boost::asio::ip::tcp::acceptor (GetService (), m_LocalEndpoint));
// update the local end point in case port has been set zero and got updated now
m_LocalEndpoint = m_Acceptor->local_endpoint();
m_Acceptor->listen (); m_Acceptor->listen ();
Accept (); Accept ();
} catch (std::exception& ex) { } catch (std::exception& ex) {