Skip to content

Commit

Permalink
Fix windows build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonKnittel committed Jan 7, 2025
1 parent de5276f commit 0aa568e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions bin/sswinservice.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
use std::{
ffi::OsString,
future::Future,
process::ExitCode,
sync::atomic::{AtomicU32, Ordering},
time::Duration,
};

use clap::Command;
use log::{error, info};
use shadowsocks_rust::service::{local, manager, server};
use shadowsocks_rust::{
error::ShadowsocksResult,
service::{local, manager, server},
};
use tokio::{runtime::Runtime, sync::oneshot};
use windows_service::{
define_windows_service,
Expand Down Expand Up @@ -53,11 +55,11 @@ fn set_service_status(

fn handle_create_service_result<F>(
status_handle: ServiceStatusHandle,
create_service_result: Result<(Runtime, F), ExitCode>,
create_service_result: ShadowsocksResult<(Runtime, F)>,
stop_receiver: oneshot::Receiver<()>,
) -> Result<(), windows_service::Error>
where
F: Future<Output = ExitCode>,
F: Future<Output = ShadowsocksResult>,
{
match create_service_result {
Ok((runtime, main_fut)) => {
Expand Down Expand Up @@ -101,8 +103,8 @@ where
Duration::default(),
)?;
}
Err(exit_code) => {
error!("failed to create service, exit code: {:?}", exit_code);
Err(err) => {
error!("failed to create service, exit code: {:?}", err.exit_code());

// Report running state
set_service_status(
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub mod allocator;
pub mod config;
#[cfg(unix)]
pub mod daemonize;
mod error;
pub mod error;
#[cfg(feature = "logging")]
pub mod logging;
pub mod monitor;
Expand Down

0 comments on commit 0aa568e

Please sign in to comment.