| 344 | |
| 345 | |
| 346 | int InitializeWebServer(std::vector<HANDLE>& threads, int port) { |
| 347 | webserver_port = port; |
| 348 | hStopEventWeb = CreateEvent(NULL, TRUE, FALSE, NULL); |
| 349 | if (hStopEventWeb == NULL) { |
| 350 | LOG_A(LOG_ERROR, "WEB: Failed to create stop event"); |
| 351 | return 1; |
| 352 | } |
| 353 | webserver_thread = CreateThread(NULL, 0, WebserverThread, NULL, 0, NULL); |
| 354 | if (webserver_thread == NULL) { |
| 355 | LOG_A(LOG_ERROR, "WEB: Failed to create thread for webserver"); |
| 356 | CloseHandle(hStopEventWeb); |
| 357 | hStopEventWeb = NULL; |
| 358 | return 1; |
| 359 | } |
| 360 | LOG_A(LOG_DEBUG, "!Web: Thread started"); |
| 361 | threads.push_back(webserver_thread); |
| 362 | return 0; |
| 363 | } |
| 364 | |
| 365 | |
| 366 | void StopWebServer() { |