| 116 | } |
| 117 | |
| 118 | void I2PControlService::Stop () |
| 119 | { |
| 120 | if (m_IsRunning) |
| 121 | { |
| 122 | m_IsRunning = false; |
| 123 | if (m_Acceptor) m_Acceptor->cancel (); |
| 124 | #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) |
| 125 | if (m_LocalAcceptor) |
| 126 | { |
| 127 | auto path = m_LocalAcceptor->local_endpoint().path(); |
| 128 | m_LocalAcceptor->cancel (); |
| 129 | std::remove (path.c_str ()); |
| 130 | } |
| 131 | #endif |
| 132 | m_Service.stop (); |
| 133 | if (m_Thread) |
| 134 | { |
| 135 | m_Thread->join (); |
| 136 | m_Thread = nullptr; |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | void I2PControlService::Run () |
| 142 | { |