(options: DefaultServiceLaunchOptions)
| 2663 | } |
| 2664 | |
| 2665 | fn run_default_service(options: DefaultServiceLaunchOptions) -> anyhow::Result<()> { |
| 2666 | let selector = options.selector; |
| 2667 | let launch_options = ServiceLaunchOptions { |
| 2668 | port: options.port, |
| 2669 | bind: options.bind, |
| 2670 | advertise_host: options.advertise_host, |
| 2671 | client_root: options.client_root, |
| 2672 | video_codec: options.video_codec, |
| 2673 | android_gpu: options.android_gpu, |
| 2674 | low_latency: options.low_latency, |
| 2675 | realtime_stream: false, |
| 2676 | allow_port_probe: !options.autostart, |
| 2677 | stream_quality_profile: local_stream_quality_profile( |
| 2678 | options.low_latency, |
| 2679 | options.stream_quality, |
| 2680 | ), |
| 2681 | local_stream_fps: options.local_stream_fps, |
| 2682 | }; |
| 2683 | let (metadata, started) = if !options.port_explicit && !options.autostart { |
| 2684 | if let Some(result) = service::active()? { |
| 2685 | (metadata_from_launch_agent(result)?, false) |
| 2686 | } else if let Some(metadata) = read_service_metadata().ok().flatten() { |
| 2687 | if service_is_healthy(&metadata) && service_binary_matches_current(&metadata)? { |
| 2688 | (metadata, false) |
| 2689 | } else { |
| 2690 | ensure_singleton_service_with_status(launch_options)? |
| 2691 | } |
| 2692 | } else { |
| 2693 | ensure_singleton_service_with_status(launch_options)? |
| 2694 | } |
| 2695 | } else if options.autostart { |
| 2696 | (ensure_launch_agent_service(launch_options)?, true) |
| 2697 | } else { |
| 2698 | ensure_singleton_service_with_status(launch_options)? |
| 2699 | }; |
| 2700 | if options.open { |
| 2701 | open_browser(&ui_url_from_base( |
| 2702 | metadata.http_url.clone(), |
| 2703 | selector.as_deref(), |
| 2704 | ))?; |
| 2705 | } |
| 2706 | print_service_metadata_result(&metadata, selector.as_deref(), false, started) |
| 2707 | } |
| 2708 | |
| 2709 | fn start_detached_service(options: ServiceLaunchOptions) -> anyhow::Result<()> { |
| 2710 | let (metadata, started) = ensure_project_service_with_status(options)?; |
no test coverage detected