diff options
author | Alex Auvolat <alex@adnab.me> | 2022-09-01 12:15:50 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-09-01 12:15:50 +0200 |
commit | cd203f5708907c2bf172a3c5b7c5b40e2557b2f4 (patch) | |
tree | 8b3eb284106d0f6b5af1ad4ad447c8004ff4c6f5 /src/client.rs | |
parent | 745c78618479c4177647e4d7fed97d5fd2d00d4f (diff) | |
download | netapp-cd203f5708907c2bf172a3c5b7c5b40e2557b2f4.tar.gz netapp-cd203f5708907c2bf172a3c5b7c5b40e2557b2f4.zip |
Add OrderTag to Req and Resp, refactor errors
Diffstat (limited to 'src/client.rs')
-rw-r--r-- | src/client.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/client.rs b/src/client.rs index 0dcbdf1..aef7bbb 100644 --- a/src/client.rs +++ b/src/client.rs @@ -35,7 +35,7 @@ pub(crate) struct ClientConn { pub(crate) remote_addr: SocketAddr, pub(crate) peer_id: NodeID, - query_send: ArcSwapOption<mpsc::UnboundedSender<(RequestID, RequestPriority, ByteStream)>>, + query_send: ArcSwapOption<mpsc::UnboundedSender<SendStream>>, next_query_number: AtomicU32, inflight: Mutex<HashMap<RequestID, oneshot::Sender<ByteStream>>>, @@ -165,7 +165,7 @@ impl ClientConn { // Encode request let req_enc = req.into_enc(prio, path.as_bytes().to_vec().into(), telemetry_id); let req_msg_len = req_enc.msg.len(); - let req_stream = req_enc.encode(); + let (req_stream, req_order) = req_enc.encode(); // Send request through let (resp_send, resp_recv) = oneshot::channel(); @@ -175,7 +175,10 @@ impl ClientConn { "Too many inflight requests! RequestID collision. Interrupting previous request." ); let _ = old_ch.send(Box::pin(futures::stream::once(async move { - Err(std::io::Error::new(std::io::ErrorKind::Other, "RequestID collision, too many inflight requests")) + Err(std::io::Error::new( + std::io::ErrorKind::Other, + "RequestID collision, too many inflight requests", + )) }))); } |