* @brief Asynchronously starts the Sunshine service. */
| 159 | * @brief Asynchronously starts the Sunshine service. |
| 160 | */ |
| 161 | bool start_service() { |
| 162 | if (!service_handle) { |
| 163 | return false; |
| 164 | } |
| 165 | |
| 166 | if (!StartServiceA(service_handle, 0, nullptr)) { |
| 167 | auto winerr = GetLastError(); |
| 168 | if (winerr != ERROR_SERVICE_ALREADY_RUNNING) { |
| 169 | BOOST_LOG(error) << "StartService() failed: "sv << winerr; |
| 170 | return false; |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | return true; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * @brief Query the service status. |