| 205 | } |
| 206 | |
| 207 | void SOCKSHandler::Terminate() |
| 208 | { |
| 209 | if (Kill()) return; |
| 210 | if (m_sock) |
| 211 | { |
| 212 | LogPrint(eLogDebug, "SOCKS: Closing socket"); |
| 213 | m_sock->close(); |
| 214 | m_sock = nullptr; |
| 215 | } |
| 216 | if (m_upstreamSock) |
| 217 | { |
| 218 | LogPrint(eLogDebug, "SOCKS: Closing upstream socket"); |
| 219 | m_upstreamSock->close(); |
| 220 | m_upstreamSock = nullptr; |
| 221 | } |
| 222 | #if defined(BOOST_ASIO_HAS_LOCAL_SOCKETS) |
| 223 | if (m_upstreamLocalSock) |
| 224 | { |
| 225 | LogPrint(eLogDebug, "SOCKS: Closing upstream local socket"); |
| 226 | m_upstreamLocalSock->close(); |
| 227 | m_upstreamLocalSock = nullptr; |
| 228 | } |
| 229 | #endif |
| 230 | if (m_stream) |
| 231 | { |
| 232 | LogPrint(eLogDebug, "SOCKS: Closing stream"); |
| 233 | m_stream->AsyncClose (); |
| 234 | m_stream = nullptr; |
| 235 | } |
| 236 | if (m_UDPTunnel) |
| 237 | { |
| 238 | m_UDPTunnel->Stop (); |
| 239 | GetServer ()->ReleaseLocalUDPPort (m_UDPTunnel->GetLocalEndpoint ().port ()); |
| 240 | m_UDPTunnel = nullptr; |
| 241 | } |
| 242 | Done(shared_from_this()); |
| 243 | } |
| 244 | |
| 245 | boost::asio::const_buffer SOCKSHandler::GenerateSOCKS4Response(SOCKSHandler::errTypes error, uint32_t ip, uint16_t port) |
| 246 | { |
nothing calls this directly
no test coverage detected