| 366 | static Client *the_client = nullptr; // GLOBAL |
| 367 | |
| 368 | static void worker_thread() |
| 369 | { |
| 370 | #if !defined(OPENVPN_OVPNCLI_SINGLE_THREAD) |
| 371 | openvpn_io::detail::signal_blocker signal_blocker; // signals should be handled by parent thread |
| 372 | #endif |
| 373 | try { |
| 374 | std::cout << "Thread starting..." << std::endl; |
| 375 | ClientAPI::Status connect_status = the_client->connect(); |
| 376 | if (connect_status.error) |
| 377 | { |
| 378 | std::cout << "connect error: "; |
| 379 | if (!connect_status.status.empty()) |
| 380 | std::cout << connect_status.status << ": "; |
| 381 | std::cout << connect_status.message << std::endl; |
| 382 | } |
| 383 | } |
| 384 | catch (const std::exception& e) |
| 385 | { |
| 386 | std::cout << "Connect thread exception: " << e.what() << std::endl; |
| 387 | } |
| 388 | std::cout << "Thread finished" << std::endl; |
| 389 | } |
| 390 | |
| 391 | static std::string read_profile(const char *fn, const std::string* profile_content) |
| 392 | { |
no test coverage detected