| 271 | } |
| 272 | |
| 273 | bool Server::start(int port) { |
| 274 | if (mRunning) { |
| 275 | mLastError = "Server already running"; |
| 276 | return false; |
| 277 | } |
| 278 | |
| 279 | if (!setup_listen_socket(port)) { |
| 280 | return false; |
| 281 | } |
| 282 | |
| 283 | mPort = port; |
| 284 | mRunning = true; |
| 285 | mLastError.clear(); |
| 286 | |
| 287 | // Register with async system for automatic updates |
| 288 | if (!mAsyncRunner) { |
| 289 | mAsyncRunner = fl::make_unique<ServerAsyncRunner>(this); |
| 290 | task::Executor::instance().register_runner(mAsyncRunner.get()); |
| 291 | } |
| 292 | |
| 293 | return true; |
| 294 | } |
| 295 | |
| 296 | void Server::stop() { |
| 297 | if (!mRunning) return; |
no test coverage detected