diff --git a/crates/unftp-auth-jsonfile/examples/jsonfile_auth.rs b/crates/unftp-auth-jsonfile/examples/jsonfile_auth.rs index d4c1c276..05aa9ba5 100644 --- a/crates/unftp-auth-jsonfile/examples/jsonfile_auth.rs +++ b/crates/unftp-auth-jsonfile/examples/jsonfile_auth.rs @@ -14,7 +14,6 @@ async fn main() -> Result<(), Box> { let server = libunftp::Server::with_fs(std::env::temp_dir()) .authenticator(Arc::new(authenticator)) .build() - .await .unwrap(); println!("Starting ftp server on {}", addr); diff --git a/crates/unftp-auth-rest/examples/rest.rs b/crates/unftp-auth-rest/examples/rest.rs index 974820e7..e40f5b6f 100644 --- a/crates/unftp-auth-rest/examples/rest.rs +++ b/crates/unftp-auth-rest/examples/rest.rs @@ -26,7 +26,6 @@ async fn main() -> Result<(), Box> { let server = libunftp::Server::with_fs(std::env::temp_dir()) .authenticator(Arc::new(authenticator)) .build() - .await .unwrap(); println!("Starting ftp server on {}", addr); diff --git a/crates/unftp-sbe-fs/examples/basic.rs b/crates/unftp-sbe-fs/examples/basic.rs index 63607606..c8974602 100644 --- a/crates/unftp-sbe-fs/examples/basic.rs +++ b/crates/unftp-sbe-fs/examples/basic.rs @@ -7,7 +7,7 @@ async fn main() { pretty_env_logger::init(); let addr = "127.0.0.1:2121"; - let server = libunftp::Server::with_fs(std::env::temp_dir()).build().await.unwrap(); + let server = libunftp::Server::with_fs(std::env::temp_dir()).build().unwrap(); println!("Starting ftp server on {}", addr); server.listen(addr).await.unwrap(); diff --git a/crates/unftp-sbe-fs/examples/cap-ftpd-worker.rs b/crates/unftp-sbe-fs/examples/cap-ftpd-worker.rs index f26cadb8..d78da87e 100644 --- a/crates/unftp-sbe-fs/examples/cap-ftpd-worker.rs +++ b/crates/unftp-sbe-fs/examples/cap-ftpd-worker.rs @@ -255,7 +255,7 @@ async fn main() { sb = sb.binder(binder); } } - let server: Server = sb.build().await.unwrap(); + let server: Server = sb.build().unwrap(); cfg_if! { if #[cfg(target_os = "freebsd")] { capsicum::enter().unwrap(); diff --git a/crates/unftp-sbe-fs/examples/cap-ftpd.rs b/crates/unftp-sbe-fs/examples/cap-ftpd.rs index 875eaeca..883f2e68 100644 --- a/crates/unftp-sbe-fs/examples/cap-ftpd.rs +++ b/crates/unftp-sbe-fs/examples/cap-ftpd.rs @@ -21,7 +21,6 @@ async fn main() { let server = libunftp::Server::with_fs(std::env::temp_dir()) .connection_helper(helper.into(), helper_args) .build() - .await .unwrap(); println!("Starting ftp server on {}", addr); diff --git a/crates/unftp-sbe-fs/examples/proxyprotocol.rs b/crates/unftp-sbe-fs/examples/proxyprotocol.rs index cb34910f..4c4b8f81 100644 --- a/crates/unftp-sbe-fs/examples/proxyprotocol.rs +++ b/crates/unftp-sbe-fs/examples/proxyprotocol.rs @@ -11,7 +11,6 @@ async fn main() { .proxy_protocol_mode(2121) .passive_ports(5000..5005) .build() - .await .unwrap(); println!("Starting ftp server with proxy protocol on {}", addr); diff --git a/crates/unftp-sbe-fs/src/lib.rs b/crates/unftp-sbe-fs/src/lib.rs index 6b7f6c67..7ec72810 100644 --- a/crates/unftp-sbe-fs/src/lib.rs +++ b/crates/unftp-sbe-fs/src/lib.rs @@ -13,7 +13,6 @@ //! .greeting("Welcome to my FTP server") //! .passive_ports(50000..65535) //! .build() -//! .await //! .unwrap(); //! //! server.listen("127.0.0.1:2121").await; diff --git a/crates/unftp-sbe-fs/tests/main.rs b/crates/unftp-sbe-fs/tests/main.rs index 323a6f37..c59b3823 100644 --- a/crates/unftp-sbe-fs/tests/main.rs +++ b/crates/unftp-sbe-fs/tests/main.rs @@ -39,7 +39,7 @@ where let tempdir = tempfile::TempDir::new().unwrap(); let root = tempdir.path().to_path_buf(); - let server = s(root.clone()).build().await.unwrap().listen(addr.clone()); + let server = s(root.clone()).build().unwrap().listen(addr.clone()); tokio::spawn(server); while async_ftp::FtpStream::connect(&addr).await.is_err() { diff --git a/crates/unftp-sbe-gcs/examples/gcs.rs b/crates/unftp-sbe-gcs/examples/gcs.rs index 703aa6b6..a9afda08 100644 --- a/crates/unftp-sbe-gcs/examples/gcs.rs +++ b/crates/unftp-sbe-gcs/examples/gcs.rs @@ -92,7 +92,6 @@ pub async fn main() -> Result<(), Box> { })) .ftps(ftps_certs_file, ftps_key_file) .build() - .await .unwrap() .listen(BIND_ADDRESS) .await?; @@ -101,7 +100,6 @@ pub async fn main() -> Result<(), Box> { unftp_sbe_gcs::CloudStorage::with_api_base(&gcs_base_url, &bucket_name, PathBuf::new(), service_account_key.clone()) })) .build() - .await .unwrap() .listen(BIND_ADDRESS) .await?; diff --git a/crates/unftp-sbe-gcs/src/lib.rs b/crates/unftp-sbe-gcs/src/lib.rs index 2c978257..54c31352 100644 --- a/crates/unftp-sbe-gcs/src/lib.rs +++ b/crates/unftp-sbe-gcs/src/lib.rs @@ -27,7 +27,6 @@ //! .greeting("Welcome to my FTP server") //! .passive_ports(50000..65535) //! .build() -//! .await //! .unwrap(); //! //! server.listen("127.0.0.1:2121").await; @@ -50,7 +49,6 @@ //! .greeting("Welcome to my FTP server") //! .passive_ports(50000..65535) //! .build() -//! .await //! .unwrap(); //! //! server.listen("127.0.0.1:2121").await; diff --git a/src/lib.rs b/src/lib.rs index 1f599405..fa43944a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,7 +33,6 @@ //! .greeting("Welcome to my FTP server") //! .passive_ports(50000..65535) //! .build() -//! .await //! .unwrap(); //! //! server.listen("127.0.0.1:2121").await; diff --git a/src/server/ftpserver.rs b/src/server/ftpserver.rs index c7274332..f2393a07 100644 --- a/src/server/ftpserver.rs +++ b/src/server/ftpserver.rs @@ -42,7 +42,7 @@ use std::{ffi::OsString, fmt::Debug, future::Future, net::SocketAddr, ops::Range /// /// let mut rt = Runtime::new().unwrap(); /// rt.spawn(async { -/// let server = Server::with_fs("/srv/ftp").build().await.unwrap(); +/// let server = Server::with_fs("/srv/ftp").build().unwrap(); /// server.listen("127.0.0.1:2121").await.unwrap() /// }); /// ``` @@ -205,7 +205,7 @@ where } /// Finalize the options and build a [`Server`]. - pub async fn build(self) -> std::result::Result, ServerError> { + pub fn build(self) -> std::result::Result, ServerError> { let ftps_mode = match self.ftps_mode { FtpsConfig::Off => FtpsConfig::Off, FtpsConfig::Building { certs_file, key_file } => FtpsConfig::On { @@ -685,7 +685,7 @@ where /// /// let mut rt = Runtime::new().unwrap(); /// rt.spawn(async { - /// let server = Server::with_fs("/srv/ftp").build().await.unwrap(); + /// let server = Server::with_fs("/srv/ftp").build().unwrap(); /// server.listen("127.0.0.1:2121").await /// }); /// // ... diff --git a/tests/common.rs b/tests/common.rs index da837d58..aa3f50b2 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -17,7 +17,6 @@ pub async fn run_with_auth() { .greeting("Welcome test") .failed_logins_policy(FailedLoginsPolicy::new(3, std::time::Duration::new(5, 0), FailedLoginsBlock::User)) .build() - .await .unwrap(); server.listen(addr).await.unwrap(); }