Skip to content

Commit

Permalink
Try 3 to fix the build on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed Dec 10, 2024
1 parent 0fd4222 commit be371d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ pub mod notification;
pub(crate) mod server;
pub mod storage;

pub use crate::server::{
ftpserver::{error::ServerError, options, Server, ServerBuilder},
RETR_SOCKETS,
};
pub use crate::server::ftpserver::{error::ServerError, options, Server, ServerBuilder};
#[cfg(unix)]
pub use crate::server::RETR_SOCKETS;

type BoxError = Box<dyn std::error::Error + Send + Sync + 'static>;
21 changes: 11 additions & 10 deletions src/server/datachan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ use crate::{
};

use crate::server::chancomms::DataChanCmd;
use std::{
path::PathBuf,
sync::Arc,
};
#[cfg(unix)]
use std::{
net::SocketAddr,
os::fd::{AsRawFd, BorrowedFd, RawFd},
sync::atomic::{AtomicU64, Ordering},
};
use std::{path::PathBuf, sync::Arc};
use tokio::io::{AsyncRead, AsyncWrite, AsyncWriteExt, ReadBuf};
use tokio::net::TcpStream;
use tokio::sync::mpsc::{Receiver, Sender};
Expand Down Expand Up @@ -106,7 +103,7 @@ struct MeasuringWriter<W: AsRawFd> {
command: &'static str,
}
#[cfg(not(unix))]
struct MeasuringWriter {
struct MeasuringWriter<W> {
writer: W,
command: &'static str,
}
Expand Down Expand Up @@ -185,13 +182,17 @@ impl<R: AsyncRead + Unpin> AsyncRead for MeasuringReader<R> {
}
}

#[cfg(unix)]
impl<W: AsRawFd> MeasuringWriter<W> {
fn new(writer: W, command: &'static str) -> MeasuringWriter<W> {
#[cfg(unix)]
{
let retr_socket = RetrSocket::new(&writer).expect("TODO: better error handling");
RETR_SOCKETS.write().unwrap().insert(retr_socket.fd, retr_socket);
}
let retr_socket = RetrSocket::new(&writer).expect("TODO: better error handling");
RETR_SOCKETS.write().unwrap().insert(retr_socket.fd, retr_socket);
Self { writer, command }
}
}
#[cfg(not(unix))]
impl<W> MeasuringWriter<W> {
fn new(writer: W, command: &'static str) -> MeasuringWriter<W> {
Self { writer, command }
}
}
Expand Down

0 comments on commit be371d7

Please sign in to comment.