diff options
author | Alex Auvolat <alex@adnab.me> | 2022-07-21 17:34:53 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-07-21 17:37:52 +0200 |
commit | f35fa7d18d9e0f51bed311355ec1310b1d311ab3 (patch) | |
tree | b42e093f1de42e3d537ef7d55daf9d89b98a10a9 /src/server.rs | |
parent | cdff8ae1beab44a22d0eb0eb00c624e49971b6ca (diff) | |
download | netapp-f35fa7d18d9e0f51bed311355ec1310b1d311ab3.tar.gz netapp-f35fa7d18d9e0f51bed311355ec1310b1d311ab3.zip |
Move things around
Diffstat (limited to 'src/server.rs')
-rw-r--r-- | src/server.rs | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/server.rs b/src/server.rs index 8075484..1f1c22a 100644 --- a/src/server.rs +++ b/src/server.rs @@ -2,8 +2,17 @@ use std::net::SocketAddr; use std::sync::Arc; use arc_swap::ArcSwapOption; +use async_trait::async_trait; use log::{debug, trace}; +use futures::channel::mpsc::UnboundedReceiver; +use futures::io::{AsyncReadExt, AsyncWriteExt}; +use kuska_handshake::async_std::{handshake_server, BoxStream}; +use tokio::net::TcpStream; +use tokio::select; +use tokio::sync::{mpsc, watch}; +use tokio_util::compat::*; + #[cfg(feature = "telemetry")] use opentelemetry::{ trace::{FutureExt, Span, SpanKind, TraceContextExt, TraceId, Tracer}, @@ -14,22 +23,11 @@ use opentelemetry_contrib::trace::propagator::binary::*; #[cfg(feature = "telemetry")] use rand::{thread_rng, Rng}; -use tokio::net::TcpStream; -use tokio::select; -use tokio::sync::{mpsc, watch}; -use tokio_util::compat::*; - -use futures::channel::mpsc::UnboundedReceiver; -use futures::io::{AsyncReadExt, AsyncWriteExt}; - -use async_trait::async_trait; - -use kuska_handshake::async_std::{handshake_server, BoxStream}; - use crate::error::*; +use crate::message::*; use crate::netapp::*; -use crate::proto::*; -use crate::proto2::*; +use crate::recv::*; +use crate::send::*; use crate::util::*; // The client and server connection structs (client.rs and server.rs) @@ -55,7 +53,7 @@ pub(crate) struct ServerConn { netapp: Arc<NetApp>, - resp_send: ArcSwapOption<mpsc::UnboundedSender<(RequestID, RequestPriority, AssociatedStream)>>, + resp_send: ArcSwapOption<mpsc::UnboundedSender<(RequestID, RequestPriority, ByteStream)>>, } impl ServerConn { @@ -126,8 +124,8 @@ impl ServerConn { async fn recv_handler_aux( self: &Arc<Self>, bytes: &[u8], - stream: AssociatedStream, - ) -> Result<(Vec<u8>, Option<AssociatedStream>), Error> { + stream: ByteStream, + ) -> Result<(Vec<u8>, Option<ByteStream>), Error> { let msg = QueryMessage::decode(bytes)?; let path = String::from_utf8(msg.path.to_vec())?; |