| 146 | } |
| 147 | |
| 148 | void TcpServer::shutdown() |
| 149 | { |
| 150 | active = false; |
| 151 | |
| 152 | debug_i("Shutting down the server ..."); |
| 153 | |
| 154 | if(tcp) { |
| 155 | tcp_arg(tcp, nullptr); |
| 156 | tcp_accept(tcp, nullptr); |
| 157 | tcp_close(tcp); |
| 158 | |
| 159 | tcp = nullptr; |
| 160 | } |
| 161 | |
| 162 | if(connections.count() == 0) { |
| 163 | delete this; |
| 164 | return; |
| 165 | } |
| 166 | |
| 167 | for(auto& connection : connections) { |
| 168 | if(connection != nullptr) { |
| 169 | connection->setTimeOut(1); |
| 170 | } |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | void TcpServer::onClientDestroy(TcpConnection& connection) |
| 175 | { |
no test coverage detected