@@ -9,7 +9,7 @@ use crate::error::DvcPipeProxyError;
99use crate :: message:: RawDataDvcMessage ;
1010use crate :: os_pipe:: OsPipe ;
1111
12- const IO_BUFFER_SIZE : usize = 1024 * 64 ; // 64K
12+ const IO_BUFFER_SIZE : usize = 1024 * 64 ;
1313
1414pub ( crate ) type OnWriteDvcMessage = Box < dyn Fn ( u32 , Vec < SvcMessage > ) -> PduResult < ( ) > + Send > ;
1515
@@ -65,59 +65,6 @@ async fn process_client<P: OsPipe>(ctx: &mut WorkerCtx) -> Result<NextWorkerStat
6565 let pipe_name = & ctx. pipe_name ;
6666 let channel_name = & ctx. channel_name ;
6767
68- /*
69- match fs::metadata(&ctx.pipe_name).await
70- {
71- Ok(metadata) => {
72- use std::os::unix::fs::FileTypeExt;
73-
74- info!(
75- %channel_name,
76- %pipe_name,
77- "DVC pipe already exists, removing stale file."
78- );
79-
80- // Just to be sure, check if it's indeed a socket -
81- // throw an error if calling code accidentally passed a regular file.
82- if !metadata.file_type().is_socket() {
83- return Err(DvcPipeProxyError::Io(std::io::Error::new(
84- std::io::ErrorKind::InvalidInput,
85- format!("Path {} is not a socket", ctx.pipe_name),
86- )));
87- }
88-
89- fs::remove_file(&ctx.pipe_name).await.map_err(DvcPipeProxyError::Io)?;
90- }
91- Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
92- trace!(
93- %pipe_name,
94- %channel_name,
95- "DVC pipe does not exist, creating it."
96- );
97- }
98- Err(e) => {
99- return Err(DvcPipeProxyError::Io(e));
100- }
101- }
102-
103- let listener = tokio::net::UnixListener::bind(&ctx.pipe_name)
104- .map_err(DvcPipeProxyError::Io)?;
105-
106- info!(%pipe_name, %pipe_name, "Waiting for DVC pipe connection...");
107-
108- let mut pipe = tokio::select! {
109- stream = listener.accept() => {
110- let (pipe, _) = stream.map_err(DvcPipeProxyError::Io)?;
111- info!(%channel_name, %pipe_name,"DVC proxy worker thread has started.");
112- pipe
113- }
114- _ = ctx.abort_event.notified() => {
115- info!(%channel_name, %pipe_name, "DVC proxy worker thread has been aborted.");
116- return Ok(NextWorkerState::Abort);
117- }
118- };
119- */
120-
12168 let mut pipe = tokio:: select! {
12269 pipe = P :: connect( pipe_name) => {
12370 info!( %channel_name, %pipe_name, "DVC proxy worker thread has started." ) ;
0 commit comments